/**
 * =============================================================================
 * NexusBuild Admin - Styles
 * =============================================================================
 * Admin dashboard specific styles
 * =============================================================================
 */

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 240px;
    background: var(--gradient-dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-header .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--cyan-bright);
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md) 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--gray-300);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-item.active {
    background: rgba(0, 204, 204, 0.1);
    color: var(--cyan-bright);
    border-left-color: var(--cyan-primary);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--gray-700);
}

.server-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 12px;
    color: var(--gray-400);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-500);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background: var(--error);
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: var(--spacing-xl);
    background: var(--bg-primary);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xl);
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--spacing-xs);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.last-update {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: var(--spacing-md);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stats-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

/* Metric Card */
.metric-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

.metric-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.metric-icon {
    font-size: 20px;
}

.metric-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan-dark);
    margin-bottom: var(--spacing-md);
}

.metric-bar {
    height: 8px;
    background: var(--gray-150);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.metric-bar-fill {
    height: 100%;
    background: var(--gradient-cyan);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.metric-bar-fill.warning {
    background: var(--warning);
}

.metric-bar-fill.danger {
    background: var(--error);
}

.metric-detail {
    font-size: 12px;
    color: var(--text-muted);
}

/* Stat Card */
.stat-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

.stat-number {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--gray-700);
    margin-bottom: var(--spacing-xs);
}

.stat-card .stat-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.stat-queued .stat-number { color: var(--warning); }
.stat-building .stat-number { color: var(--cyan-primary); }
.stat-success .stat-number { color: var(--success); }
.stat-failed .stat-number { color: var(--error); }

/* Section */
.section {
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--cyan-primary);
    display: inline-block;
}

/* Storage Grid */
.storage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.storage-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

.storage-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cyan-subtle);
    border-radius: var(--radius-md);
}

.storage-info {
    flex: 1;
}

.storage-value {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--gray-700);
}

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

.storage-size {
    font-size: 14px;
    font-family: var(--font-mono);
    color: var(--cyan-dark);
    font-weight: 600;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

.tool-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.tool-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.tool-name {
    font-weight: 500;
    color: var(--gray-700);
}

.tool-status {
    font-size: 12px;
    font-family: var(--font-mono);
}

.tool-status.ok {
    color: var(--success);
}

.tool-status.missing {
    color: var(--error);
}

/* Activity List */
.activity-list {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s ease;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: var(--gray-50);
}

.activity-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.activity-status.success { background: var(--success); }
.activity-status.failed { background: var(--error); }
.activity-status.building { background: var(--cyan-primary); animation: pulse 1s infinite; }
.activity-status.queued { background: var(--warning); }

.activity-info {
    flex: 1;
}

.activity-id {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--cyan-dark);
}

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

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

.activity-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-muted);
}

/* =============================================================================
   Logs Page Styles
   ============================================================================= */

/* Filters Bar */
.filters-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.filter-stats {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* Logs Container */
.logs-container {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.logs-list {
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.logs-loading,
.logs-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-muted);
}

.log-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.2s ease;
}

.log-item:last-child {
    border-bottom: none;
}

.log-item:hover {
    background: var(--gray-50);
}

.log-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.log-status.status-success { background: var(--success); }
.log-status.status-failed { background: var(--error); }
.log-status.status-building { background: var(--cyan-primary); animation: pulse 1s infinite; }
.log-status.status-queued { background: var(--warning); }

.log-info {
    flex: 1;
    min-width: 0;
}

.log-id {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--cyan-dark);
}

.log-repo {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-meta {
    display: flex;
    gap: var(--spacing-sm);
}

.log-time {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

.log-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.log-item:hover .log-actions {
    opacity: 1;
}

/* Log Viewer Panel */
.log-viewer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 60%;
    max-width: 900px;
    height: 100vh;
    background: var(--gray-900);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.log-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--gray-800);
    border-bottom: 1px solid var(--gray-700);
}

.log-viewer-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--white);
    font-family: var(--font-mono);
    font-size: 14px;
}

.log-viewer-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
}

.log-viewer-status.status-success { background: var(--success); color: var(--white); }
.log-viewer-status.status-failed { background: var(--error); color: var(--white); }
.log-viewer-status.status-building { background: var(--cyan-primary); color: var(--white); }
.log-viewer-status.status-queued { background: var(--warning); color: var(--gray-900); }

.log-viewer-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.log-viewer-content {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--gray-300);
}

.log-line {
    padding: 2px 0;
}

.log-line.log-success {
    color: var(--success);
}

.log-line.log-error {
    color: var(--error);
}

.log-line.log-warning {
    color: var(--warning);
}

.log-line.log-section {
    color: var(--cyan-bright);
    font-weight: 600;
    margin-top: var(--spacing-sm);
}

.log-line.log-info {
    color: var(--gray-400);
}

.log-empty {
    color: var(--gray-500);
    font-style: italic;
}

/* Badges */
.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.badge-react-native { background: #61dafb22; color: #61dafb; }
.badge-expo { background: #00020522; color: #fff; border: 1px solid #444; }
.badge-flutter { background: #02569b22; color: #54c5f8; }
.badge-unknown { background: var(--gray-100); color: var(--gray-600); }
.badge-debug { background: var(--warning); color: var(--gray-900); }
.badge-release { background: var(--success); color: var(--white); }

/* =============================================================================
   Storage Page Styles
   ============================================================================= */

/* Storage Overview */
.storage-overview {
    margin-bottom: var(--spacing-xl);
}

.storage-total-card {
    background: var(--gradient-dark);
    border-radius: var(--radius-md);
    padding: var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    color: var(--white);
}

.storage-total-icon {
    font-size: 48px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.storage-total-info {
    flex: 1;
}

.storage-total-value {
    font-size: 48px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan-bright);
}

.storage-total-label {
    font-size: 14px;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.storage-total-disk {
    min-width: 200px;
}

.storage-disk-label {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: var(--spacing-sm);
}

.storage-disk-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.storage-disk-fill {
    height: 100%;
    background: var(--gradient-cyan);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.storage-disk-fill.warning {
    background: var(--warning);
}

.storage-disk-fill.danger {
    background: var(--error);
}

.storage-disk-detail {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--gray-300);
}

/* Storage Categories */
.storage-categories {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.storage-category-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

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

.category-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-100);
}

.category-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cyan-subtle);
    border-radius: var(--radius-sm);
}

.category-info {
    flex: 1;
}

.category-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.category-stats {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.category-list {
    max-height: 300px;
    overflow-y: auto;
}

.category-loading,
.category-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-bottom: 1px solid var(--gray-50);
}

.file-item:last-child {
    border-bottom: none;
}

.file-name {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: 11px;
    color: var(--text-muted);
}

.file-size {
    font-family: var(--font-mono);
}

.file-more {
    padding: var(--spacing-sm) var(--spacing-lg);
    text-align: center;
    font-size: 12px;
    color: var(--cyan-primary);
    background: var(--gray-50);
}

/* Build Files Info */
.build-files-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

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

.build-files-stat {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
}

.build-files-count {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan-dark);
}

.build-files-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Storage Page Responsive */
@media (max-width: 1200px) {
    .storage-categories {
        grid-template-columns: 1fr;
    }

    .storage-total-card {
        flex-wrap: wrap;
    }

    .storage-total-disk {
        width: 100%;
        margin-top: var(--spacing-md);
    }
}

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

    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .storage-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-header {
        width: 100%;
        padding: var(--spacing-md);
        justify-content: center;
    }

    .sidebar-nav {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        padding: var(--spacing-sm);
        gap: var(--spacing-xs);
    }

    .nav-item {
        padding: var(--spacing-sm) var(--spacing-md);
        border-left: none;
        border-radius: var(--radius-sm);
        font-size: 13px;
    }

    .nav-item.active {
        border-left: none;
        background: rgba(0, 204, 204, 0.2);
    }

    .sidebar-footer {
        width: 100%;
        padding: var(--spacing-sm);
        text-align: center;
    }

    .admin-main {
        margin-left: 0;
        padding: var(--spacing-md);
    }

    .stats-grid,
    .stats-grid-5 {
        grid-template-columns: 1fr;
    }

    .storage-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .log-viewer-panel {
        width: 100%;
        max-width: 100%;
    }
}
