/* GraceHaven Panel & Dashboard Styling */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;0,800;1,400;1,600&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #faf8f3;
    --bg-card: #ffffff;
    --text-main: #0d1b5e;
    --text-muted: #5a5a7a;
    --border-color: rgba(13, 27, 94, 0.12);
    
    --primary: #c9a84c;
    --primary-hover: #a8820a;
    --secondary: #080f3a;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --radius: 12px;
    --shadow-sm: 0 2px 10px rgba(13,27,94,0.06);
    --shadow: 0 4px 20px rgba(13,27,94,0.1);
    --shadow-lg: 0 10px 30px rgba(13,27,94,0.15);
}

body.panel-body, body.auth-body {
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Authentication Pages */
.auth-body {
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    padding-bottom: 40px;
}
.auth-wrapper {
    width: 100%;
    max-width: 440px;
}
.auth-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    box-sizing: border-box;
}
.auth-logo {
    text-align: center;
    margin-bottom: 20px;
}
.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 5px;
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-main);
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.forgot-link {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
}
.input-icon-wrap { position: relative; }
.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.panel-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
    box-sizing: border-box;
}
.panel-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.panel-select { padding-left: 14px; } /* no icon */

/* Buttons */
.btn-panel-primary, .btn-panel-outline, .btn-panel-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}
.btn-panel-primary {
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    font-size: 1rem;
}
.btn-panel-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-panel-primary:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-panel-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    font-size: 0.95rem;
}
.btn-panel-outline:hover { background: #f1f5f9; border-color: #cbd5e1; }

.btn-panel-sm {
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    font-size: 0.85rem;
}
.btn-panel-sm:hover { background: var(--primary-hover); }

/* Alerts */
.alert-box {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-footer a { color: var(--primary); font-weight: 500; text-decoration: none; }

/* Dashboard Layout */
.panel-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--secondary);
    color: #cbd5e1;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}
.admin-sidebar { background: #0f172a; } /* slightly different for admin */

.sidebar-logo {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-close {
    background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer;
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}
.nav-section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin: 0 12px 10px 12px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link i { margin-right: 12px; font-size: 1.1rem; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 20px;
    font-weight: 700;
}

.sidebar-user {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #334155;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
}
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-weight: 600; color: #fff; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 0.8rem; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-logout { color: #94a3b8; font-size: 1.2rem; cursor: pointer; text-decoration:none; }
.sidebar-logout:hover { color: #fff; }

.panel-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.panel-topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-menu-btn {
    background: none; border: none; font-size: 1.5rem; color: var(--text-main); margin-right: 20px; cursor: pointer; display: none;
}
.topbar-title {
    font-size: 1.25rem; font-weight: 600;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.panel-content {
    padding: 32px;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Cards & Layouts */
.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.panel-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.panel-card-title {
    margin: 0; font-size: 1.1rem; font-weight: 600; display: flex; align-items: center;
}
.panel-card-link { color: var(--primary); text-decoration: none; font-size: 0.9rem; font-weight: 500; }

.row-cols-2-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.welcome-title { margin: 0 0 8px 0; font-size: 1.75rem; font-weight: 700; color: #4c1d95; }
.welcome-sub { margin: 0; color: #5b21b6; font-size: 1.05rem; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem;
}
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; margin-bottom: 4px; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }

/* Tools Grid */
.section-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 20px; margin-top: 10px; }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #cbd5e1; }
.tool-icon {
    width: 56px; height: 56px; margin: 0 auto 16px auto;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
}
.tool-label { font-weight: 600; font-size: 1.05rem; margin-bottom: 6px; color: var(--text-main); }
.tool-desc { font-size: 0.85rem; color: var(--text-muted); }

/* Lists & Tables */
.list-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
.list-item:last-child { border-bottom: none; }
.list-item-icon {
    width: 40px; height: 40px; border-radius: 8px;
    background: #f1f5f9; color: #64748b;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; margin-right: 16px;
}
.list-item-info { flex: 1; }
.list-item-title { font-weight: 600; font-size: 1rem; color: var(--text-main); margin-bottom: 2px; }
.list-item-sub { font-size: 0.85rem; color: var(--text-muted); }
.list-item-right { text-align: right; }
.list-item-amount { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }

.empty-state {
    padding: 40px 20px; text-align: center; color: var(--text-muted);
}
.empty-state p { margin: 10px 0 0 0; }

.table-wrap { overflow-x: auto; }
.panel-table { width: 100%; border-collapse: collapse; }
.panel-table th {
    text-align: left; padding: 14px 24px; background: #f8fafc;
    color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.panel-table td {
    padding: 16px 24px; border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem; vertical-align: middle;
}
.panel-table tr:last-child td { border-bottom: none; }

/* Badges */
.badge {
    display: inline-block; padding: 4px 10px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
}
.bg-success { background: #dcfce7; color: #166534; }
.bg-warning { background: #fef3c7; color: #b45309; }
.bg-danger { background: #fee2e2; color: #991b1b; }
.bg-info { background: #e0f2fe; color: #075985; }
.bg-primary { background: #ede9fe; color: #5b21b6; }
.bg-secondary { background: #f1f5f9; color: #475569; }

/* Billing Page */
.card-display {
    padding: 24px;
    display: flex; justify-content: space-between; align-items: center;
}
.saved-card-visual {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff; padding: 20px 24px; border-radius: 12px;
    width: 300px; position: relative; overflow: hidden;
}
.saved-card-visual::after {
    content: ''; position: absolute; right: -20px; top: -20px;
    width: 100px; height: 100px; background: rgba(255,255,255,0.05); border-radius: 50%;
}
.sc-brand { font-weight: 700; font-size: 1.2rem; margin-bottom: 15px; letter-spacing: 1px; }
.sc-number { font-size: 1.2rem; font-family: monospace; letter-spacing: 2px; margin-bottom: 10px; }
.sc-exp { font-size: 0.9rem; color: #94a3b8; }
.stripe-card-wrap { padding: 24px; max-width: 500px; }
.stripe-element {
    padding: 14px; border: 1px solid var(--border-color); border-radius: 8px; background: #fff; margin-bottom: 10px;
}
.card-error-msg { color: var(--danger); font-size: 0.85rem; min-height: 20px; margin-bottom: 10px; }
.stripe-note { font-size: 0.85rem; color: var(--text-muted); margin-top: 15px; }

.plans-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-bottom: 40px;
}
.plan-card {
    background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius);
    padding: 32px 24px; text-align: center; position: relative; transition: all 0.2s;
}
.plan-featured {
    border: 2px solid var(--primary); box-shadow: 0 10px 25px -5px rgba(139,92,246,0.15); transform: translateY(-4px);
}
.plan-badge {
    position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: #fff; font-size: 0.75rem; font-weight: 700;
    padding: 4px 12px; border-radius: 20px; text-transform: uppercase; letter-spacing: 1px;
}
.plan-name { font-size: 1.25rem; font-weight: 600; color: var(--text-main); margin-bottom: 10px; }
.plan-price { margin-bottom: 24px; }
.price-currency { font-size: 1.25rem; font-weight: 600; vertical-align: top; margin-top: 5px; display: inline-block; }
.price-amount { font-size: 3rem; font-weight: 800; color: var(--text-main); line-height: 1; }
.price-period { font-size: 1rem; color: var(--text-muted); font-weight: 500; }
.plan-trial-badge {
    display: inline-block; background: #dcfce7; color: #166534; font-size: 0.85rem; font-weight: 600;
    padding: 6px 16px; border-radius: 8px; margin-bottom: 24px;
}
.plan-features {
    list-style: none; padding: 0; margin: 0 0 32px 0; text-align: left;
}
.plan-features li {
    padding: 10px 0; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; color: var(--text-main); font-size: 0.95rem;
}
.plan-features li i { color: var(--primary); margin-right: 12px; font-size: 1.1rem; }
.btn-plan-buy { width: 100%; background: var(--secondary); color: #fff; padding: 14px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-plan-buy:hover { background: #1e293b; }
.btn-plan-trial { width: 100%; background: #10b981; color: #fff; padding: 14px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; margin-bottom: 12px; transition: 0.2s; }
.btn-plan-trial:hover { background: #059669; }

/* Modals */
.iz-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15,23,42,0.6); backdrop-filter: blur(4px);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 20px; box-sizing: border-box;
}
.iz-modal {
    background: #fff; width: 100%; max-width: 400px; border-radius: 16px;
    padding: 32px; box-shadow: var(--shadow-lg); text-align: center;
}
.iz-modal-icon {
    width: 64px; height: 64px; border-radius: 50%; background: #ede9fe; color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 2rem;
    margin: 0 auto 20px auto;
}
.iz-modal-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 10px 0; }
.iz-modal-body { color: var(--text-muted); font-size: 0.95rem; margin: 0 0 24px 0; line-height: 1.5; }
.iz-modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Toast */
.iz-toast {
    position: fixed; bottom: 24px; right: 24px; padding: 14px 24px;
    border-radius: 8px; font-weight: 500; font-size: 0.95rem;
    color: #fff; box-shadow: var(--shadow-lg);
    transform: translateY(20px); opacity: 0; transition: all 0.3s; z-index: 3000;
}
.iz-toast-success { background: #10b981; }
.iz-toast-error { background: #ef4444; }
.iz-toast-warning { background: #f59e0b; }
.iz-toast-info { background: #3b82f6; }

/* Admin Settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 24px; }
.settings-alert { padding: 16px 24px; background: #fffbeb; border-bottom: 1px solid #fde68a; color: #b45309; font-size: 0.95rem; display: flex; align-items: center; }

@keyframes spin { 100% { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 1s linear infinite; }

/* Responsive */
@media (max-width: 991.98px) {
    .panel-sidebar { transform: translateX(-100%); }
    .panel-sidebar.open { transform: translateX(0); }
    .panel-main { margin-left: 0; }
    .topbar-menu-btn, .sidebar-close { display: block; }
    .sidebar-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 900;
        display: none;
    }
    .sidebar-overlay.active { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .row-cols-2-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .card-display { flex-direction: column; gap: 20px; align-items: flex-start; }
}
@media (max-width: 575.98px) {
    .stats-grid { grid-template-columns: 1fr; }
    .welcome-banner { flex-direction: column; text-align: center; gap: 20px; }
    .tools-grid { grid-template-columns: repeat(2, 1fr); }
    .iz-modal-actions { grid-template-columns: 1fr; }
    /* Auth pages on small screens */
    .auth-body { padding: 16px; padding-top: 24px; padding-bottom: 24px; align-items: flex-start; }
    .auth-wrapper { max-width: 100%; }
    .auth-card { padding: 24px 18px; }
    .auth-title { font-size: 1.3rem !important; }
}

/* Custom Responsive Form Grid */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (min-width: 576px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
    .form-col-span-2 {
        grid-column: span 2;
    }
}
