/**
 * Backup Manager - Enterprise Dashboard Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
    --bg: #f8fafc;
    --bg-dark: #0f172a;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-light: #eef2ff;
    --primary-dark: #4f46e5;
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
}

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

/* Layout - Fixed */
.app {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Icon Sidebar */
.icon-sidebar {
    background: var(--bg-dark);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 64px;
    z-index: 100;
}

.icon-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 32px;
}

.icon-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    color: #64748b;
    font-size: 18px;
    margin: 0 auto;
    border: none;
    background: transparent;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

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

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.icon-spacer {
    flex: 1;
}

.icon-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #f472b6, #c084fc);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Main Content - Fixed */
.main-content {
    flex: 1;
    margin-left: 64px;
    width: calc(100% - 64px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.topbar-tabs {
    display: flex;
    gap: 8px;
}

.topbar-tab {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: transparent;
}

.topbar-tab:hover {
    background: var(--bg);
    color: var(--text);
}

.topbar-tab.active {
    background: var(--primary-light);
    color: var(--primary);
}

.topbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.topbar-user:hover {
    background: var(--bg);
}

.topbar-user-name {
    font-size: 13px;
    font-weight: 500;
}

/* Buttons */
.btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

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

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

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

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

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

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

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

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

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

/* Dashboard Grid */
.dashboard {
    padding: 24px 32px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(100px, auto);
    gap: 20px;
    flex: 1;
    overflow-y: auto;
}

/* Widgets */
.widget {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.widget-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-title {
    font-size: 14px;
    font-weight: 600;
}

.widget-body {
    padding: 20px;
}

/* Stat Widgets */
.stat-widget {
    grid-column: span 3;
}

.stat-widget .widget-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.stat-trend {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.trend-up {
    background: var(--success-light);
    color: var(--success);
}

.trend-neutral {
    background: var(--bg);
    color: var(--text-muted);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.purple {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.green {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.yellow {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.blue {
    background: var(--info-light);
    color: var(--info);
}

/* Backup List Widget */
.backup-widget {
    grid-column: span 4;
    grid-row: span 2;
}

.backup-mini-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.backup-mini-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.backup-mini-item:hover {
    background: var(--border);
}

.backup-mini-item.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.backup-mini-icon {
    width: 40px;
    height: 40px;
    background: var(--card);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.backup-mini-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

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

.backup-mini-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.backup-mini-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.backup-mini-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge-full {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-incr {
    background: var(--success-light);
    color: var(--success);
}

/* File Browser Widget */
.browser-widget {
    grid-column: span 8;
    grid-row: span 2;
}

.browser-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.breadcrumb-item {
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.breadcrumb-item:hover {
    background: var(--card);
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--text);
    font-weight: 500;
}

.breadcrumb-sep {
    color: var(--border);
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    width: 200px;
    background: var(--card);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* File Table */
.file-table {
    width: 100%;
}

.file-row {
    display: grid;
    grid-template-columns: 36px 1fr 100px 80px 100px;
    gap: 12px;
    padding: 12px 20px;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.file-row:hover {
    background: var(--bg);
}

.file-row-header {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    cursor: default;
    background: var(--bg);
}

.file-row-header:hover {
    background: var(--bg);
}

.file-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.file-icon.folder {
    background: #fef3c7;
    color: #d97706;
}

.file-icon.php {
    background: #ede9fe;
    color: #7c3aed;
}

.file-icon.css {
    background: #dbeafe;
    color: #2563eb;
}

.file-icon.js {
    background: #fef9c3;
    color: #ca8a04;
}

.file-icon.html {
    background: #fee2e2;
    color: #dc2626;
}

.file-icon.json {
    background: #d1fae5;
    color: #059669;
}

.file-icon.default {
    background: var(--bg);
    color: var(--text-muted);
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 13px;
    color: var(--text-muted);
}

.file-date {
    font-size: 13px;
    color: var(--text-muted);
}

.file-status {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    text-align: center;
}

.status-changed {
    background: var(--success-light);
    color: var(--success);
}

.status-new {
    background: var(--primary-light);
    color: var(--primary);
}

.status-deleted {
    background: var(--danger-light);
    color: var(--danger);
}

/* Activity Widget */
.activity-widget {
    grid-column: span 4;
    grid-row: span 2;
}

.activity-list {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon svg {
    width: 16px;
    height: 16px;
}

.activity-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.activity-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.activity-icon.info {
    background: var(--primary-light);
    color: var(--primary);
}

.activity-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 13px;
    margin-bottom: 2px;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border: none;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

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

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Code Preview */
.code-preview {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.code-preview .line-number {
    color: #64748b;
    margin-right: 16px;
    user-select: none;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    min-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--info);
}

.toast-message {
    flex: 1;
    font-size: 14px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1400px) {
    .stat-widget {
        grid-column: span 6;
    }

    .browser-widget {
        grid-column: span 12;
    }

    .backup-widget {
        grid-column: span 6;
    }

    .activity-widget {
        grid-column: span 6;
    }
}

@media (max-width: 1024px) {
    .app {
        display: block;
    }

    .icon-sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .dashboard {
        padding: 16px;
    }

    .stat-widget,
    .backup-widget,
    .activity-widget,
    .browser-widget {
        grid-column: span 12;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-tabs {
        display: none;
    }
}

@media (max-width: 768px) {
    .file-row {
        grid-template-columns: 32px 1fr 60px;
    }

    .file-row > *:nth-child(4),
    .file-row > *:nth-child(5) {
        display: none;
    }

    .modal {
        margin: 16px;
        max-width: calc(100% - 32px);
    }
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s;
    z-index: 100;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(8px);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--bg);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger svg {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}
