/* OAuth Admin - Modern Dark Dashboard Theme */
:root {
    /* Dark theme colors matching Spectra design */
    --bg-primary: #2b2d31;
    --bg-secondary: #36393f;
    --bg-card: #3a3d42;
    --bg-spotlight: #e8e9eb; /* Light French gray for spotlight cards */
    
    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #b5b9c0;
    --text-muted: #7b8189;
    
    /* Accent colors */
    --accent-blue: #5b7cff;
    --accent-purple: #a78bfa;
    --accent-orange: #fb923c;
    --accent-green: #10b981;
    --success-color: #10b981;
    --warning-color: #fb923c;
    --danger-color: #ef4444;
    
    /* UI Elements */
    --border-color: #4a4d55;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-width: 200px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

/* Login Styles */
.login-container {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--bg-card);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-warning {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: #4a6be8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 124, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--text-secondary);
}

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

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 13px;
}

.full-width {
    width: 100%;
}

.error-message {
    color: var(--danger-color);
    font-size: 13px;
    display: none;
}

/* Admin Container */
.admin-container {
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

/* Top Header Bar */
.top-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 16px;
    width: auto;
    filter: brightness(0) invert(1);
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Content Wrapper (Sidebar + Main) */
.content-wrapper {
    display: flex;
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: fixed;
    left: 0;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
    z-index: 200;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.nav-item {
    margin: 0.25rem 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
    cursor: pointer;
}

.nav-link i {
    width: 20px;
    font-size: 16px;
    text-align: center;
}

.nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - 64px);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    font-size: 13px;
}

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

.status-indicator.online {
    background: var(--success-color);
}

.status-indicator.offline {
    background: var(--danger-color);
}

.status-indicator.checking {
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Spotlight Card (like Profit card) */
.card.spotlight {
    background: var(--bg-spotlight);
    color: #2b2d31;
    border: 1px solid #d1d5db;
}

.card.spotlight .card-title {
    color: #2b2d31;
    font-size: 13px;
    font-weight: 500;
}

.card.spotlight .card-menu {
    color: #6b7280;
}

.card.spotlight .card-value {
    font-size: 36px;
    font-weight: 700;
    color: #1a1c1f;
    margin: 1rem 0 0.5rem;
}

.card.spotlight .card-change {
    font-size: 12px;
    color: #5b7cff;
    font-weight: 500;
}

.card.spotlight .card-icon {
    text-align: center;
    margin: 1.5rem 0;
    opacity: 0.8;
}

/* Regular Cards */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    font-size: 16px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.card-change {
    font-size: 12px;
    color: var(--text-secondary);
}

.card-change.positive {
    color: var(--success-color);
}

.card-change.negative {
    color: var(--danger-color);
}

.card-menu {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 16px;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

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

.data-table thead {
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    text-align: left;
    padding: 0.75rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.status-connected,
.status-badge.status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.status-expired,
.status-badge.status-warning {
    background: rgba(251, 146, 60, 0.1);
    color: var(--warning-color);
}

.status-badge.status-disconnected,
.status-badge.status-inactive {
    background: rgba(123, 129, 137, 0.1);
    color: var(--text-muted);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

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

.tab-button.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

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

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

/* Info Panels */
.info-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
}

.info-panel h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h4 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.info-section ul {
    margin: 0.75rem 0 0.75rem 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.info-section li {
    margin-bottom: 0.5rem;
}

.info-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Search Input */
.search-input {
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%237b8189'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background-color: var(--bg-card);
}

/* Section */
.section {
    margin-bottom: 2rem;
}

.section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

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

.section-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .header-title {
        font-size: 14px;
    }
    
    .top-header-right .btn-sm span {
        display: none;
    }
}

@media (max-width: 768px) {
    .top-header {
        padding: 0.75rem 1rem;
    }
    
    .header-logo {
        height: 14px;
    }
    
    .server-status {
        display: none;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-form {
        padding: 1rem;
    }
    
    .modal-actions {
        flex-direction: column-reverse;
    }
    
    .modal-actions button {
        width: 100%;
    }
}

/* Loading state */
.loading-row {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* Tab description */
.tab-header {
    margin-bottom: 2rem;
}

.tab-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tab-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent-blue);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(450px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10000;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification i {
    font-size: 20px;
}

.notification-success {
    border-left-color: var(--success-color);
}

.notification-success i {
    color: var(--success-color);
}

.notification-error {
    border-left-color: var(--danger-color);
}

.notification-error i {
    color: var(--danger-color);
}

.notification-info {
    border-left-color: var(--accent-blue);
}

.notification-info i {
    color: var(--accent-blue);
}

.notification span {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-form {
    padding: 1.5rem;
}

.modal-form .form-group {
    margin-bottom: 1.5rem;
}

.modal-form .form-group:last-of-type {
    margin-bottom: 0;
}

.modal-form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.modal-form .form-input,
.modal-form .form-select,
.modal-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.modal-form .form-input:focus,
.modal-form .form-select:focus,
.modal-form textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(91, 124, 255, 0.1);
}

.modal-form .form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
}

.modal-form textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.modal-form small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 12px;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-help {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(91, 124, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--accent-blue);
    display: block;
}

.form-help p {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
    font-weight: 500;
}

.form-help p:last-child {
    margin-bottom: 0;
}

.form-help ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.form-help li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.form-help li:last-child {
    margin-bottom: 0;
}

.form-help b,
.form-help strong {
    color: var(--text-primary);
}

/* Environment and Status Badges */
.status,
[data-env] {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status[data-env="dev"],
[data-env="dev"] {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.status[data-env="staging"],
[data-env="staging"] {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.status[data-env="prod"],
.status[data-env="production"],
[data-env="prod"],
[data-env="production"] {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Code elements in tables */
table code {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    color: var(--accent-purple);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Actions cell */
.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    margin-right: 0.5rem;
}

.actions-cell .btn:last-child {
    margin-right: 0;
}

/* No data state */
.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}
