/* ============================================
   Cost Insight by Operisoft
   World-class Cloud Spending Portal
   ============================================ */

:root {
    --primary: #0f1b4c;
    --primary-light: #1a2d6d;
    --primary-lighter: #2a4494;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --gradient: linear-gradient(135deg, #0f1b4c 0%, #1e3a8a 50%, #2563eb 100%);
    --gradient-accent: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Login Screen
   ============================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--gradient);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    filter: blur(80px);
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.1);
    filter: blur(80px);
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(20px);
}

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

.login-header .logo { margin-bottom: 16px; }

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

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

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background: white;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 0.2px;
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.error-message {
    background: #fef2f2;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #fecaca;
}

.success-message {
    background: #ecfdf5;
    color: #065f46;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #a7f3d0;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.login-footer p { color: var(--text-light); font-size: 11px; }
.login-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }
.login-footer a:hover { text-decoration: underline; }

.login-links { text-align: center; margin-top: 16px; }
.login-links a { color: var(--accent); font-size: 13px; text-decoration: none; font-weight: 500; }
.login-links a:hover { text-decoration: underline; }

.password-requirements {
    background: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.password-requirements p { font-weight: 500; margin-bottom: 4px; }
.password-requirements ul { margin: 0; padding-left: 16px; }
.password-requirements li { margin-bottom: 2px; }

/* ============================================
   App Layout
   ============================================ */

.app-container { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-name { font-size: 15px; font-weight: 700; color: white; letter-spacing: -0.2px; }
.brand-sub { font-size: 10px; color: rgba(255,255,255,0.5); display: block; margin-top: 2px; letter-spacing: 0.5px; text-transform: uppercase; }

.nav-menu { list-style: none; padding: 16px 12px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(59, 130, 246, 0.2); color: white; }
.nav-icon { font-size: 16px; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .powered-by {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    text-align: center;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    width: 100%;
    padding: 9px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-logout:hover { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 28px 36px;
    min-height: 100vh;
    background: var(--bg);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.content-header h2 { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.subtitle { color: var(--text-muted); font-size: 13px; margin-top: 3px; }

/* Month Picker */
.month-selector { display: flex; align-items: center; gap: 12px; }

.month-picker {
    padding: 9px 36px 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    background: white;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    min-width: 160px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.month-picker:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.08); }

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-md); }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); letter-spacing: -0.2px; }

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card { text-align: center; padding: 28px 20px; position: relative; overflow: hidden; }
.summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.card-value { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.card-change { font-size: 12px; font-weight: 600; margin-top: 8px; }
.card-change.increase { color: var(--danger); }
.card-change.decrease { color: var(--success); }
.card-change.flat { color: var(--text-muted); }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Insights */
.insights-section { margin-bottom: 24px; }
.insights-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid;
}
.insight-item.warning { background: #fffbeb; border-color: var(--warning); }
.insight-item.success { background: #ecfdf5; border-color: var(--success); }
.insight-item.info { background: #eff6ff; border-color: var(--accent); }
.insight-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.insight-description { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Charts */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-card { min-height: 320px; }
.chart-card canvas { max-height: 260px; }

.chart-card-full {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
    min-height: 380px;
}
.chart-card-full h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.chart-card-full canvas { max-height: 320px; }

/* Tables */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
.data-table td { padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border-light); }
.data-table tr:hover { background: var(--border-light); }
.data-table td:nth-child(2), .data-table th:nth-child(2) { text-align: right; font-weight: 600; }
.data-table td:nth-child(3), .data-table th:nth-child(3) { text-align: right; }

/* Reports - Grouped */
.reports-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }

.btn-secondary {
    padding: 8px 14px;
    background: white;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-generate {
    padding: 9px 18px;
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}
.btn-generate:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.25); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.generate-status { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; }
.generate-status.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.generate-status.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.generate-status.loading { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.reports-grouped { display: flex; flex-direction: column; gap: 16px; }

.report-month-group {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.report-month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}
.report-month-header h4 { font-size: 14px; font-weight: 600; color: var(--primary); margin: 0; }

.btn-delete-small { background: none; border: none; cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 4px; opacity: 0.4; transition: var(--transition); }
.btn-delete-small:hover { opacity: 1; background: #fef2f2; }

.report-files-row { display: flex; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }

.report-file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex: 1;
    min-width: 240px;
    transition: var(--transition);
}
.report-file-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.report-file-icon { font-size: 22px; }
.report-file-info { flex: 1; display: flex; flex-direction: column; }
.report-file-type { font-size: 13px; font-weight: 600; color: var(--text); }
.report-file-size { font-size: 11px; color: var(--text-muted); }

.btn-download-sm {
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}
.btn-download-sm:hover { background: var(--primary-light); }

/* Settings */
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-header-row h3 { margin-bottom: 0; }

.settings-list { margin-top: 16px; }

.settings-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
}
.settings-list-item:hover { background: var(--border-light); }
.settings-item-info { display: flex; align-items: center; gap: 12px; }
.settings-item-email { font-size: 13px; font-weight: 500; }
.settings-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-admin { background: #eff6ff; color: #1d4ed8; }
.badge-viewer { background: #ecfdf5; color: #059669; }
.badge-verified { background: #ecfdf5; color: #059669; }
.badge-pending { background: #fffbeb; color: #d97706; }

.btn-delete-text { background: none; border: none; color: var(--danger); font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-family: inherit; opacity: 0.6; transition: var(--transition); }
.btn-delete-text:hover { opacity: 1; background: #fef2f2; }

.settings-info-grid { margin-top: 12px; display: grid; gap: 10px; }
.settings-info-item { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--border-light); border-radius: var(--radius-sm); }
.settings-info-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.settings-info-value { font-size: 12px; font-weight: 500; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; z-index: 9998; padding: 20px; backdrop-filter: blur(4px); }
.modal-card { background: white; border-radius: var(--radius); padding: 28px; width: 100%; max-width: 420px; box-shadow: var(--shadow-xl); }
.modal-card h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Pages */
.page { display: none; }
.page.active { display: block; }

/* Loading */
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(248,250,252,0.85); display: flex; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(2px); }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading { text-align: center; padding: 40px; color: var(--text-muted); font-size: 13px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h4 { font-size: 15px; margin-bottom: 6px; color: var(--text); }

/* Terms & Legal */
.legal-page { max-width: 700px; margin: 0 auto; }
.legal-page h3 { font-size: 18px; margin-bottom: 20px; }
.legal-page h4 { font-size: 14px; margin: 20px 0 8px; color: var(--primary); }
.legal-page p, .legal-page li { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 8px; }
.legal-page ul { padding-left: 20px; }
.legal-page .legal-header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.legal-page .legal-header p { font-size: 12px; }

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

@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar .brand-name, .sidebar .brand-sub, .sidebar .nav-text, .sidebar .powered-by { display: none; }
    .sidebar-header { justify-content: center; padding: 16px; }
    .nav-item { justify-content: center; padding: 12px; }
    .main-content { margin-left: 64px; padding: 16px; }
    .summary-cards { grid-template-columns: 1fr 1fr; }
    .content-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .card-value { font-size: 20px; }
}

@media (max-width: 480px) {
    .summary-cards { grid-template-columns: 1fr; }
    .main-content { padding: 12px; }
    .report-files-row { flex-direction: column; }
    .report-file-card { min-width: unset; }
}


/* Collapsible Cards */
.collapsible .collapsible-header {
    cursor: pointer;
    user-select: none;
    padding-bottom: 0;
}

.collapsible .collapsible-header:hover {
    opacity: 0.85;
}

.collapse-icon {
    font-size: 14px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    display: inline-block;
}

.collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible .collapsible-body {
    margin-top: 14px;
    transition: all 0.2s ease;
}

.collapsible.collapsed .collapsible-body {
    display: none;
}


/* Domain Progress Steps */
.domain-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.progress-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.progress-text { flex: 1; }

.progress-done { background: #ecfdf5; color: #065f46; }
.progress-active { background: #eff6ff; color: #1e40af; }
.progress-pending { background: var(--border-light); color: var(--text-muted); }
.progress-warning { background: #fffbeb; color: #92400e; }
.progress-error { background: #fef2f2; color: #991b1b; }

/* DNS Records Box */
.dns-records-box {
    margin-top: 12px;
    padding: 16px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.dns-records-box p { font-size: 12px; margin-bottom: 8px; }
.dns-section-title { font-weight: 600; color: var(--text); margin-top: 12px; }
.dns-section-title:first-child { margin-top: 0; }

.dns-record {
    display: grid;
    grid-template-columns: 60px 1fr 1fr;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    word-break: break-all;
    border: 1px solid var(--border);
}

.dns-type { font-weight: 600; color: var(--primary); }
.dns-name { color: var(--text-muted); }
.dns-value { color: var(--text); }
