:root {
    /* Dark mode background - deep blue-gray */
    --background: hsl(220, 30%, 10%);
    --foreground: hsl(210, 40%, 98%);
    
    /* Darker card backgrounds for contrast */
    --card: hsl(220, 30%, 13%);
    --card-foreground: hsl(210, 40%, 98%);
    
    /* Primary accent - Teal for dark mode */
    --primary: hsl(165, 70%, 45%);
    --primary-hover: hsl(165, 70%, 55%);
    --primary-foreground: hsl(210, 40%, 98%);
    
    /* Secondary accent - Light blue for dark mode */
    --secondary: hsl(195, 70%, 45%);
    --secondary-hover: hsl(195, 70%, 55%);
    --secondary-foreground: hsl(210, 40%, 98%);
    
    /* Accent - Dark blue for dark mode */
    --accent: hsl(220, 70%, 45%);
    --accent-hover: hsl(220, 70%, 55%);
    --accent-foreground: hsl(210, 40%, 98%);
    
    /* Purple for dark mode */
    --purple: hsl(260, 70%, 55%);
    --purple-hover: hsl(260, 70%, 65%);
    
    /* Status colors for dark mode */
    --success: hsl(142, 76%, 45%);
    --success-light: hsl(142, 76%, 20%);
    --success-dark: hsl(142, 76%, 60%);
    
    --danger: hsl(0, 70%, 50%);
    --danger-light: hsl(0, 70%, 20%);
    --danger-dark: hsl(0, 70%, 60%);
    
    --warning: hsl(38, 92%, 50%);
    --warning-light: hsl(38, 92%, 20%);
    
    /* Muted backgrounds for subtle elements */
    --muted: hsl(220, 20%, 20%);
    --muted-foreground: hsl(210, 20%, 80%);
    
    /* Border and input styling - more visible in dark mode */
    --border: hsl(220, 20%, 25%);
    --input: hsl(220, 20%, 18%);
    --input-border: hsl(220, 20%, 30%);
    
    /* Ring focus styling */
    --ring: hsl(260, 70%, 55%);
    
    /* Text colors */
    --text: hsl(210, 40%, 98%);
    --text-light: hsl(210, 20%, 70%);
    
    /* Background shades */
    --bg: hsl(220, 30%, 10%);
    --card-bg: hsl(220, 30%, 13%);
    
    --radius: 0.5rem;
}

.light {
    /* Background and foreground */
    --background: hsl(180, 5%, 98%);
    --foreground: hsl(220, 30%, 18%);
    
    /* Card styling - slightly elevated from background */
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(220, 30%, 18%);
    
    /* Primary accent - Teal #39d3a7 */
    --primary: hsl(165, 70%, 53%);
    --primary-hover: hsl(165, 70%, 45%);
    --primary-foreground: hsl(210, 40%, 98%);
    
    /* Secondary accent - Light blue #39b2d3 */
    --secondary: hsl(195, 70%, 53%);
    --secondary-hover: hsl(195, 70%, 45%);
    --secondary-foreground: hsl(210, 40%, 98%);
    
    /* Accent - Dark blue #3965d3 */
    --accent: hsl(220, 70%, 53%);
    --accent-hover: hsl(220, 70%, 45%);
    --accent-foreground: hsl(210, 40%, 98%);
    
    /* Purple - #5a39d3 */
    --purple: hsl(260, 70%, 53%);
    --purple-hover: hsl(260, 70%, 45%);
    
    /* Status colors */
    --success: hsl(142, 76%, 36%);
    --success-light: hsl(142, 76%, 96%);
    --success-dark: hsl(142, 76%, 20%);
    
    --danger: hsl(0, 84%, 60%);
    --danger-light: hsl(0, 84%, 96%);
    --danger-dark: hsl(0, 84%, 35%);
    
    --warning: hsl(38, 92%, 50%);
    --warning-light: hsl(38, 92%, 96%);
    
    /* Muted backgrounds for subtle elements */
    --muted: hsl(180, 10%, 94%);
    --muted-foreground: hsl(220, 10%, 40%);
    
    /* Border and input styling */
    --border: hsl(180, 10%, 85%);
    --input: hsl(0, 0%, 100%);
    --input-border: hsl(180, 10%, 85%);
    
    /* Ring focus styling */
    --ring: hsl(260, 70%, 53%);
    
    /* Text colors */
    --text: hsl(220, 30%, 18%);
    --text-light: hsl(220, 10%, 40%);
    
    /* Background shades */
    --bg: hsl(180, 5%, 98%);
    --card-bg: hsl(0, 0%, 100%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    font-feature-settings: "rlig" 1, "calt" 1;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom scrollbar for modern browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    opacity: 0.4;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    opacity: 0.6;
}

/* Focus styles */
*:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--ring);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--card);
    padding: 20px 30px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, 
        var(--primary),
        var(--secondary),
        var(--accent),
        var(--purple)
    );
}

header:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

header h1 {
    font-size: 24px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--muted-foreground);
    font-size: 14px;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        hsl(220, 30%, 10%) 0%, 
        hsl(220, 30%, 15%) 50%, 
        hsl(220, 30%, 10%) 100%
    );
}

.login-box {
    background: var(--card);
    padding: 40px;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--secondary), var(--accent), var(--purple));
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--muted-foreground);
    font-size: 14px;
}

.btn-block {
    width: 100%;
    margin-top: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--foreground);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    background: var(--input);
    color: var(--foreground);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(57, 211, 167, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--muted-foreground);
    opacity: 0.6;
}

.form-group input[readonly] {
    background: var(--muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 14px;
    color: var(--muted-foreground);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 20px;
}

/* Tables */
.table-container {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(57, 211, 167, 0.08);
    transition: box-shadow 0.3s ease;
}

.table-container:hover {
    box-shadow: 0 6px 16px rgba(57, 211, 167, 0.12);
}

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

thead {
    background: var(--muted);
}

th {
    padding: 15px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-foreground);
}

td {
    padding: 15px;
    border-top: 1px solid var(--border);
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background: var(--muted);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: var(--success);
    color: white;
}

.status-inactive {
    background: var(--danger);
    color: white;
}

.key-display {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: var(--bg);
    padding: 4px 8px;
    border-radius: 4px;
}

.machine-id {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: var(--muted);
    padding: 3px 6px;
    border-radius: 3px;
    color: var(--foreground);
}

.machine-location {
    font-size: 13px;
    color: var(--muted-foreground);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* Release Info */
.release-info {
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(57, 211, 167, 0.08);
    position: relative;
    overflow: hidden;
}

.release-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary), var(--accent));
}

.release-info h3 {
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-section {
    padding: 20px;
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 30px;
    border: 2px dashed var(--border);
    transition: all 0.3s ease;
}

.upload-section:hover {
    border-color: var(--primary);
    background: var(--card);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card);
    padding: 0;
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, var(--primary), var(--secondary), var(--accent));
}

.modal-content h3 {
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 20px;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    background: var(--muted);
}

/* Utilities */
.error {
    color: var(--danger);
    font-size: 14px;
    margin-top: 10px;
}

.success {
    color: var(--success);
    font-size: 14px;
    margin-top: 10px;
}

.loading {
    text-align: center;
    color: var(--text-light);
    padding: 40px !important;
}

/* Monitor Tab */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.monitor-card {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(57, 211, 167, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.monitor-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.monitor-card:hover::before {
    opacity: 1;
}

.monitor-card:hover {
    box-shadow: 0 6px 16px rgba(57, 211, 167, 0.12);
}

.monitor-card.full-width {
    grid-column: 1 / -1;
}

.monitor-card h3 {
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 16px;
}

.endpoint-box {
    background: var(--muted);
    padding: 12px;
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    border-left: 3px solid var(--primary);
}

.result-box {
    margin-top: 15px;
    padding: 15px;
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.result-box:empty {
    display: none;
}

/* API Tester */
.api-tester {
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(57, 211, 167, 0.08);
}

.api-result {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
}

.api-result h3 {
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-info {
    display: flex;
    gap: 30px;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--muted-foreground);
}

.result-info span span {
    font-weight: 600;
    color: var(--foreground);
}

#apiResponse {
    background: hsl(220, 30%, 13%);
    color: hsl(210, 40%, 98%);
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    max-height: 500px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    border-left: 3px solid var(--primary);
}

/* Files Section */
.files-section {
    margin-top: 30px;
    padding: 30px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.files-section h3 {
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.file-item {
    padding: 15px;
    background: var(--muted);
    border-radius: calc(var(--radius) - 2px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: var(--background);
    border-color: var(--primary);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 5px;
}

.file-details {
    color: var(--muted-foreground);
    font-size: 12px;
}

.file-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 10px;
    }
}