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

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

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 30px 0;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #2c5282;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
}

.help-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(66, 153, 225, 0.4);
}

/* Nach oben Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: #fff;
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.4);
    transition: all 0.3s;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
}

.scroll-to-top:hover {
    background: linear-gradient(135deg, #3182ce, #2c5282);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.5);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Cards */
.card {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid #d0d0d0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

.subnetting-section h2 {
    border-color: #3182ce;
    color: #3182ce;
}

.advanced-subnetting-section h2 {
    border-color: #6b46c1;
    color: #6b46c1;
}

.ipv6-section h2 {
    border-color: #3182ce;
    color: #3182ce;
}

.ipv6-subnets-section h2 {
    border-color: #805ad5;
    color: #805ad5;
}

.vlsm-section h2 {
    border-color: #e53e3e;
    color: #e53e3e;
}

.info-section h2 {
    border-color: #38a169;
    color: #38a169;
}

/* Input Groups */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #2d3748;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #4299e1;
}

.input-group select option {
    background: #fff;
    color: #2d3748;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 10px;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(66, 153, 225, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: #fff;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(72, 187, 120, 0.4);
}

.btn-remove {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: #fff;
    padding: 12px 15px;
    min-width: 45px;
}

.btn-remove:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(245, 101, 101, 0.4);
}

/* VLSM Inputs */
.vlsm-inputs {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #e2e8f0;
}

.vlsm-inputs h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1rem;
}

.subnet-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.subnet-input-row input {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #2d3748;
    font-size: 0.95rem;
}

.subnet-input-row input:focus {
    outline: none;
    border-color: #f56565;
}

/* Result Box */
.result-box {
    background: #edf2f7;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    display: none;
}

.result-box.show {
    display: block;
}

.result-box h3 {
    color: #2b6cb0;
    margin-bottom: 15px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
}

.result-table th,
.result-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.result-table th {
    background: #e2e8f0;
    color: #4a5568;
    font-weight: 600;
}

.result-table tr:hover {
    background: #f7fafc;
}

.result-table .network { color: #2f855a; }
.result-table .broadcast { color: #c53030; }
.result-table .range { color: #c05621; }
.result-table .hosts { color: #276749; }

/* Visual Container */
.visual-container {
    margin-top: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.visual-bar {
    display: flex;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.visual-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    min-width: 60px;
}

.visual-segment:hover {
    transform: scaleY(1.05);
    filter: brightness(1.2);
}

.visual-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-item {
    background: #ebf8ff;
    border-left: 4px solid #4299e1;
    padding: 15px;
    border-radius: 0 8px 8px 0;
}

.info-item h4 {
    color: #2b6cb0;
    margin-bottom: 8px;
}

.info-item p {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: #718096;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .subnet-input-row {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: 100%;
        margin-right: 0;
    }
    
    .visual-segment {
        font-size: 0.65rem;
        min-width: 40px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-box.show,
.visual-container {
    animation: fadeIn 0.5s ease;
}

/* Error styling */
.error {
    color: #c53030;
    background: #fff5f5;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f56565;
}

/* Success styling */
.success {
    color: #276749;
    background: #f0fff4;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #48bb78;
}

/* Tabs für erweitertes Subnetting */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px 8px 0 0;
    background: #f7fafc;
    color: #718096;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #e2e8f0;
    color: #4a5568;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea, #5a67d8);
    color: #fff;
}

/* Host Inputs */
.hosts-inputs {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #e2e8f0;
}

.hosts-inputs h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1rem;
}

.host-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.host-input-row input {
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #2d3748;
    font-size: 0.95rem;
}

.host-input-row input:focus {
    outline: none;
    border-color: #667eea;
}

/* Subnet Mode */
.subnet-mode {
    animation: fadeIn 0.3s ease;
}

/* Equal Subnets Table */
.equal-subnet-table th {
    background: #e9d8fd;
    color: #6b46c1;
}

.equal-subnet-table tr {
    border-left: 4px solid #9f7aea;
}

/* Host-based Subnet Table */
.host-subnet-table th {
    background: #c6f6d5;
    color: #276749;
}

.host-subnet-table tr {
    border-left: 4px solid #48bb78;
}

/* IPv6 Table */
.ipv6-table th {
    background: #bee3f8;
    color: #2c5282;
}

.ipv6-table tr {
    border-left: 4px solid #3182ce;
}

/* Responsive for host inputs */
@media (max-width: 600px) {
    .host-input-row {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 140px;
    }
}

/* Modal / Popup für Detailansicht */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border-radius: 20px;
    padding: 30px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #e2e8f0;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: #718096;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f56565;
    color: #fff;
    transform: rotate(90deg);
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h3 {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.modal-header .subnet-cidr {
    color: #718096;
    font-size: 1.1rem;
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section h4 {
    color: #4a5568;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-section h4 .icon {
    font-size: 1.3rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.detail-item {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    border-left: 4px solid #4299e1;
}

.detail-item.wide {
    grid-column: 1 / -1;
}

.detail-label {
    color: #718096;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.detail-value {
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.detail-value.binary {
    color: #5a67d8;
    font-size: 0.9rem;
    word-break: break-all;
}

.binary-separator {
    color: #cbd5e0;
    margin: 0 2px;
}

/* Farbcodierung für Detail-Items */
.detail-item.network { border-left-color: #48bb78; }
.detail-item.broadcast { border-left-color: #f56565; }
.detail-item.host { border-left-color: #4299e1; }
.detail-item.mask { border-left-color: #ed8936; }
.detail-item.wildcard { border-left-color: #9f7aea; }
.detail-item.range { border-left-color: #38b2ac; }

/* Hover-Effekt für klickbare Tabellenzeilen */
.result-table tr.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.result-table tr.clickable:hover {
    background: #ebf8ff;
    transform: translateX(5px);
}

.result-table tr.clickable::before {
    content: '👁 ';
    opacity: 0;
    transition: opacity 0.2s;
}

.result-table tr.clickable:hover::before {
    opacity: 1;
}
