* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 15px 20px;
    text-align: center;
}

header h1 {
    font-size: 1.5em;
    font-weight: 600;
}

.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
}

.tab-button {
    flex: 1;
    padding: 12px 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: #e8e8e8;
    color: #333;
}

.tab-button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: white;
}

.tab-content {
    display: none;
    padding: 15px;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.4);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

#layers-container {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

#layers-container h3 {
    margin-bottom: 15px;
    color: #555;
}

.layer-item {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

.layer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.layer-header h4 {
    color: #3498db;
    font-size: 18px;
}

.bundles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.bundle-item {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    position: relative;
}

.bundle-color {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 2px solid #ddd;
}

.bundle-info {
    font-size: 14px;
    color: #666;
}

.bundle-number {
    font-weight: 600;
    color: #333;
}

#search-results {
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.result-item {
    background: white;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item h4 {
    color: #3498db;
    margin-bottom: 6px;
    font-size: 16px;
}

.result-item p {
    color: #666;
    margin: 3px 0;
    font-size: 13px;
}

.fiber-visual {
    width: 100%;
    order: 1;
}

.cable-structure {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.layer-box {
    background: #f5f5f5;
    padding: 10px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

.layer-label {
    font-weight: 600;
    color: #3498db;
    margin-bottom: 8px;
    font-size: 14px;
}

.bundle-box {
    padding: 10px;
    border-radius: 6px;
    border: 2px solid;
    min-height: auto;
}

.bundle-label {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 13px;
    text-align: center;
    padding: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.fiber-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
    margin-top: 8px;
}

.fiber-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    border: 1.5px solid;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    min-height: 30px;
}

.fiber-cell:hover {
    transform: scale(1.1);
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.fiber-cell.fiber-highlight {
    position: relative;
    border-width: 3px;
    border-color: #FFD700 !important;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
    transform: scale(1.1);
    z-index: 20;
    font-weight: bold;
}

.fiber-cell.fiber-highlight::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid #FFD700;
    border-radius: 4px;
    pointer-events: none;
}

.fiber-number {
    color: #000;
    font-weight: bold;
    font-size: 9px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.85);
    padding: 1px 3px;
    border-radius: 2px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
}

/* Strich als Hintergrund-Pattern für bessere Sichtbarkeit */
.fiber-stripe {
    position: relative;
}

/* Strich als Hintergrund-Pattern - wird nicht von der Nummer überdeckt */
.fiber-stripe::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 48%,
        #000000 48%,
        #000000 52%,
        transparent 52%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 0;
}

.fiber-stripe::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #000000;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

/* Nummer bei Fasern mit Strich - halbtransparenter Hintergrund damit Strich durchscheint */
.fiber-stripe .fiber-number {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.25);
    position: relative;
    z-index: 3;
    /* Leicht versetzt, damit Strich sichtbar bleibt */
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.1);
}

/* Spezialfall: Transparent mit Strich (schwarz mit Strich) */
/* Weißer Hintergrund mit schräg grau gestreiftem Muster */
.fiber-cell[style*="transparent"] {
    background: #FFFFFF !important;
    background-image: repeating-linear-gradient(
        45deg,
        #FFFFFF,
        #FFFFFF 4px,
        #CCCCCC 4px,
        #CCCCCC 8px
    ) !important;
    border-color: #000000 !important;
    position: relative;
}

/* Schwarzer Strich durch die Faser */
.fiber-cell[style*="transparent"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #000000;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

.result-info {
    width: 100%;
    order: 2;
}

.color-picker {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #3498db;
    border-width: 3px;
}

.saved-cable-item {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.saved-cable-schema {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f9f9f9;
    padding: 5px;
}

.mini-cable-schema-svg {
    width: 100%;
    height: 100%;
}

.saved-cable-info h3 {
    color: #3498db;
    margin-bottom: 5px;
}

.saved-cable-info p {
    color: #666;
    font-size: 14px;
}

.saved-cable-actions {
    display: flex;
    gap: 10px;
}

.info-box {
    background: #e7f3ff;
    border-left: 4px solid #2196F3;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.info-box p {
    color: #1976D2;
    margin: 5px 0;
}

.error-message {
    background: #ffebee;
    border-left: 4px solid #f44336;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    color: #c62828;
}

.success-message {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    color: #2e7d32;
}

/* Gruppen-Funktionen */
.saved-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.group-filter {
    margin-bottom: 20px;
}

.group-filter label {
    margin-right: 10px;
    font-weight: 500;
}

.group-filter select {
    padding: 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.group-header {
    background: #3498db;
    color: white;
    padding: 10px 15px;
    margin-top: 20px;
    margin-bottom: 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
}

.group-header:first-child {
    margin-top: 0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
}

.group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

.group-name {
    font-weight: 500;
    font-size: 16px;
    color: #333;
}

.group-actions {
    display: flex;
    gap: 10px;
}

/* OptGroup Styling für Kabelauswahl */
optgroup {
    font-weight: 600;
    color: #3498db;
    background-color: #f5f5f5;
}

optgroup option {
    font-weight: normal;
    color: #333;
    padding-left: 20px;
}

/* Kabel-Übersicht */
.cable-overview-header {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.cable-overview-header h3 {
    color: #3498db;
    margin-bottom: 10px;
    font-size: 24px;
}

.cable-overview-header p {
    color: #666;
    margin: 5px 0;
}

.overview-layer {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.overview-layer-header {
    background: #3498db;
    color: white;
    padding: 12px 15px;
    margin: -20px -20px 15px -20px;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 18px;
}

.overview-bundle {
    margin-bottom: 25px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.overview-bundle:last-child {
    margin-bottom: 0;
}

.overview-bundle-header {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.bundle-number {
    font-size: 16px;
}

.bundle-color-name {
    font-size: 14px;
    opacity: 0.9;
}

.bundle-range {
    font-size: 13px;
    opacity: 0.8;
}

.overview-fibers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    padding: 15px;
    background: #f9f9f9;
}

.overview-fiber-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.overview-fiber-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.fiber-color-box {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
}

/* Transparente Faser in der Übersicht: weißer Hintergrund mit schräg grau gestreiftem Muster */
.fiber-color-box.fiber-stripe[style*="transparent"],
.fiber-color-box[style*="background: #FFFFFF"][style*="repeating-linear-gradient"] {
    background: #FFFFFF !important;
    background-image: repeating-linear-gradient(
        45deg,
        #FFFFFF,
        #FFFFFF 4px,
        #CCCCCC 4px,
        #CCCCCC 8px
    ) !important;
}

.fiber-info {
    flex: 1;
}

.fiber-number-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    margin-bottom: 4px;
}

.fiber-color-label {
    color: #666;
    font-size: 13px;
    margin-bottom: 2px;
}

.fiber-position-label {
    color: #999;
    font-size: 11px;
}

/* Kabel-Schema */
.cable-schema-container {
    background: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    text-align: center;
}

.cable-schema {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: #fafafa;
    border-radius: 8px;
    padding: 20px;
}

.cable-schema-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.schema-bundle {
    transition: r 0.2s, stroke-width 0.2s;
}

.schema-bundle:hover {
    r: 25;
    stroke-width: 3;
}

.schema-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.schema-tooltip strong {
    display: block;
    margin-bottom: 4px;
}

/* Mobile Anpassungen für Übersicht */
@media (max-width: 768px) {
    .overview-fibers-grid {
        grid-template-columns: 1fr;
    }
    
    .overview-bundle-header {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .cable-overview-header {
        padding: 15px;
    }
    
    .overview-layer {
        padding: 15px;
    }
    
    .cable-schema {
        min-height: 300px;
        padding: 10px;
    }
    
    .cable-schema-svg {
        max-width: 100%;
    }
}

/* Mobile Optimierungen */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    header {
        padding: 12px 15px;
    }
    
    header h1 {
        font-size: 1.3em;
    }
    
    .tab-button {
        padding: 10px 5px;
        font-size: 12px;
    }
    
    .tab-content {
        padding: 12px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .form-group input,
    .form-group select {
        padding: 8px;
        font-size: 14px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    #search-results {
        padding: 8px;
        margin-top: 12px;
    }
    
    .result-item {
        padding: 10px;
        margin-bottom: 10px;
        gap: 10px;
    }
    
    .result-item h4 {
        font-size: 15px;
        margin-bottom: 5px;
    }
    
    .result-item p {
        font-size: 12px;
        margin: 2px 0;
    }
    
    .layer-box {
        padding: 8px;
    }
    
    .layer-label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .bundle-box {
        padding: 8px;
    }
    
    .bundle-label {
        font-size: 12px;
        margin-bottom: 8px;
        padding: 3px;
    }
    
    .fiber-grid {
        gap: 2px;
        margin-top: 6px;
    }
    
    .fiber-cell {
        min-height: 25px;
        border-width: 1px;
    }
    
    .fiber-cell.fiber-highlight {
        border-width: 2px;
        transform: scale(1.05);
    }
    
    .fiber-number {
        font-size: 8px;
        padding: 1px 2px;
    }
    
    .error-message,
    .success-message,
    .info-box {
        padding: 10px;
        margin: 10px 0;
        font-size: 13px;
    }
    
    #layers-container {
        padding: 12px;
        margin-top: 15px;
    }
    
    .layer-item {
        padding: 10px;
        margin-bottom: 10px;
    }
    
    .layer-header h4 {
        font-size: 16px;
    }
    
    .bundles-container {
        gap: 8px;
        margin-top: 10px;
    }
    
    .bundle-item {
        padding: 8px;
    }
    
    .bundle-color {
        height: 30px;
        margin-bottom: 6px;
    }
    
    .bundle-info {
        font-size: 12px;
    }
    
    .saved-cable-item {
        padding: 12px;
        flex-direction: row;
        gap: 10px;
        align-items: flex-start;
    }
    
    .saved-cable-schema {
        width: 80px;
        height: 80px;
        flex-shrink: 0;
    }
    
    .saved-cable-info {
        flex: 1;
    }
    
    .saved-cable-info h3 {
        font-size: 16px;
    }
    
    .saved-cable-info p {
        font-size: 12px;
    }
    
    .saved-cable-actions {
        flex-direction: column;
        gap: 5px;
        flex-shrink: 0;
    }
    
    .saved-cable-actions .btn {
        width: 100%;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.1em;
    }
    
    .tab-button {
        font-size: 11px;
        padding: 8px 3px;
    }
    
    .fiber-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Bei 24 Fasern: 6 Spalten auf sehr kleinen Bildschirmen */
    .fiber-grid[style*="repeat(8"] {
        grid-template-columns: repeat(6, 1fr) !important;
    }
    
    .fiber-cell {
        min-height: 20px;
    }
    
    .fiber-number {
        font-size: 7px;
    }
}

