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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 100%;
    max-width: 1400px;
    margin: 20px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
}

.header p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.logout-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

.back-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    text-decoration: none;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
}

.content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Navigation Grid */
.navigation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.nav-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
    text-align: center;
}

.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background: #ffffff;
}

.nav-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.nav-card p {
    color: #6c757d;
    font-size: 0.9rem;
}

/* Login Form */
.login-form {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.login-form h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: #2c3e50;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

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

.btn-danger {
    background: #dc3545;
}

.btn-success {
    background: #28a745;
}

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

.btn-info {
    background: #17a2b8;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.9rem;
    color: #6c757d;
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
}

.tab.active {
    color: #2c3e50;
    background: #f8f9fa;
    border-bottom: 3px solid #667eea;
}

.tab:hover {
    color: #2c3e50;
    background: #f1f3f4;
}

/* Cards */
.card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
}

.table td {
    font-size: 0.9rem;
}

.table tr:hover {
    background: #f1f3f4;
}

/* Messages */
.message {
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Loading */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Layout helpers */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.three-column {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.flex-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Debug info */
.debug-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: #6c757d;
}

/* Badge styles */
.badge {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.badge.success {
    background: #d4edda;
    color: #155724;
}

.badge.error {
    background: #f8d7da;
    color: #721c24;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}

.badge.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Location tags - Enhanced styles for single server location */
.location-tag {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0.1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.location-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.location-tag.uk {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #0d47a1;
    border: 1px solid #1976d2;
}

.location-tag.eu {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    color: #4a148c;
    border: 1px solid #7b1fa2;
}

.location-tag.us {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c9);
    color: #1b5e20;
    border: 1px solid #388e3c;
}

.location-tag.asia {
    background: linear-gradient(135deg, #fff3e0, #ffcc02);
    color: #e65100;
    border: 1px solid #f57c00;
}

.location-tag.unassigned {
    background: linear-gradient(135deg, #fafafa, #eeeeee);
    color: #424242;
    border: 1px solid #757575;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.table-container {
    overflow-x: auto;
}

/* Assignment items for multi-server SKUs */
.assignment-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
}

/* Server location status indicators */
.location-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-status .status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.location-status .status-indicator.located {
    background: #28a745;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

.location-status .status-indicator.not-located {
    background: #ffc107;
    box-shadow: 0 0 4px rgba(255, 193, 7, 0.5);
}

/* Enhanced server cards with location display */
.server-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.2s ease;
}

.server-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.server-card .server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.server-card .server-name {
    font-weight: 600;
    color: #2c3e50;
}

.server-card .server-url {
    font-size: 0.8rem;
    color: #6c757d;
    font-family: monospace;
}

/* Location routing visualization */
.routing-chain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.routing-arrow {
    color: #6c757d;
    font-weight: bold;
}

.routing-step {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        max-width: 95vw;
    }
    
    .three-column {
        grid-template-columns: 1fr;
    }
    
    .navigation-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
    }
    
    .content {
        padding: 1rem;
    }
    
    .two-column {
        grid-template-columns: 1fr;
    }
    
    .tab {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .navigation-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .location-tag {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    .routing-chain {
        justify-content: center;
    }
}

/* Inactive SKU mapping styles */
.inactive-row {
    opacity: 0.6;
    background-color: #f8f9fa;
}

.inactive-row .sku-group {
    text-decoration: line-through;
}

.inactive-indicator {
    color: #dc3545;
    font-size: 0.75rem;
    font-weight: normal;
    margin-left: 0.5rem;
}
