/* ABOUTME: Styles for the VividCV admin backoffice. */
/* ABOUTME: Peach primary color, Fraunces/DM Sans fonts, sidebar layout with tables and cards. */

:root {
    --color-primary: #e07b4c;
    --color-primary-light: #e8956d;
    --color-primary-dark: #c4623a;
    --color-cream: #faf8f5;
    --color-text: #2c3e3a;
    --color-text-light: #5a6e6a;
    --color-white: #ffffff;
    --color-border: #e2ddd6;
    --color-success: #2d8a6e;
    --color-warning: #e07b4c;
    --color-error: #dc3545;
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --shadow-sm: 0 1px 3px rgba(224, 123, 76, 0.08);
    --shadow-md: 0 4px 12px rgba(224, 123, 76, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --sidebar-width: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); font-size: 16px; line-height: 1.6; color: var(--color-text); background: var(--color-cream); }
a { color: inherit; text-decoration: none; }

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

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--color-white); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar__header { padding: 20px 24px; border-bottom: 1px solid var(--color-border); }
.sidebar__logo { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--color-primary); display: flex; align-items: center; gap: 10px; }
.sidebar__logo-icon { width: 36px; height: 36px; background: var(--color-primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.sidebar__logo-icon span { color: var(--color-white); font-weight: 700; font-size: 0.85rem; }
.sidebar__logo-badge { font-size: 0.6rem; background: var(--color-text); color: white; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.sidebar__nav { flex: 1; padding: 20px 16px; }
.nav-section { margin-bottom: 24px; }
.nav-section__label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-light); padding: 0 12px; margin-bottom: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-md); color: var(--color-text-light); font-size: 0.95rem; font-weight: 500; transition: all 0.2s; }
.nav-item:hover { background: var(--color-cream); color: var(--color-text); }
.nav-item.active { background: rgba(224, 123, 76, 0.1); color: var(--color-primary); }
.nav-item svg { width: 20px; height: 20px; fill: currentColor; }
.sidebar__footer { padding: 16px; border-top: 1px solid var(--color-border); }
.sidebar__user { display: flex; align-items: center; gap: 12px; padding: 12px; }
.sidebar__user-avatar { width: 40px; height: 40px; background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; color: white; }
.sidebar__user-info { flex: 1; }
.sidebar__user-name { font-weight: 600; font-size: 0.9rem; }
.sidebar__user-role { font-size: 0.8rem; color: var(--color-text-light); }
.sidebar__logout { background: none; border: none; padding: 8px; cursor: pointer; border-radius: var(--radius-sm); color: var(--color-text-light); }
.sidebar__logout:hover { background: var(--color-cream); color: var(--color-primary); }
.sidebar__logout svg { width: 20px; height: 20px; fill: currentColor; }

/* Main Content */
.main-content { flex: 1; margin-left: var(--sidebar-width); }
.top-bar { height: 70px; background: var(--color-white); border-bottom: 1px solid var(--color-border); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 50; }
.top-bar__title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }
.top-bar__actions { display: flex; gap: 8px; }
.page-content { padding: 32px; }

/* Loading */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.page-loading { position: fixed; top: 0; left: var(--sidebar-width); right: 0; bottom: 0; background: var(--color-cream); display: flex; align-items: center; justify-content: center; z-index: 100; transition: opacity 0.3s; }
.page-loading.hidden { opacity: 0; pointer-events: none; }
.page-loading__spinner { width: 48px; height: 48px; border: 4px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 1s linear infinite; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--color-white); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); text-align: center; transition: transform 0.15s, box-shadow 0.15s; }
a.stat-card { display: block; color: inherit; }
a.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card__value { font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.stat-card__label { font-size: 0.85rem; color: var(--color-text-light); }

/* Cards */
.card { background: var(--color-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 24px; overflow: hidden; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 20px; text-align: left; }
.table th { background: var(--color-cream); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-light); border-bottom: 1px solid var(--color-border); }
.table td { border-bottom: 1px solid var(--color-border); font-size: 0.95rem; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background 0.15s; }
.table tbody tr:hover td { background: var(--color-cream); }
.table .no-hover:hover td { background: transparent; cursor: default; }

/* Cell Layouts */
.cell-with-avatar { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.8rem; color: white; flex-shrink: 0; }
.cell-name { font-weight: 600; }
.cell-sub { font-size: 0.85rem; color: var(--color-text-light); }

/* Badges */
.status-badge { display: inline-block; padding: 4px 12px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; text-transform: capitalize; }
.status-badge.active { background: rgba(45, 138, 110, 0.1); color: var(--color-success); }
.status-badge.trial { background: rgba(224, 123, 76, 0.1); color: var(--color-warning); }
.status-badge.suspended { background: rgba(220, 53, 69, 0.1); color: var(--color-error); }
.status-badge.closed { background: rgba(90, 110, 106, 0.1); color: var(--color-text-light); }
.status-badge.pending { background: rgba(224, 123, 76, 0.1); color: var(--color-warning); }
.status-badge.processing { background: rgba(224, 123, 76, 0.1); color: var(--color-warning); }
.status-badge.completed { background: rgba(45, 138, 110, 0.1); color: var(--color-success); }
.status-badge.failed { background: rgba(220, 53, 69, 0.1); color: var(--color-error); }

/* Section Labels */
.section-label { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--color-text); }
.section-label svg { width: 20px; height: 20px; fill: var(--color-primary); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-danger { background: var(--color-error); color: white; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: var(--color-white); color: var(--color-text); border: 1.5px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-cream); border-color: var(--color-primary); }
.btn-success { background: var(--color-success); color: white; }
.btn-success:hover { background: #24705a; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--color-border); margin-bottom: 24px; }
.tab { padding: 12px 20px; font-size: 0.95rem; font-weight: 500; color: var(--color-text-light); border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.2s; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Search */
.search-bar { display: flex; gap: 12px; margin-bottom: 24px; }
.search-input { flex: 1; padding: 10px 16px; font-family: var(--font-body); font-size: 0.95rem; border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-white); transition: border-color 0.2s; }
.search-input:focus { outline: none; border-color: var(--color-primary); }

/* Detail Page */
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.detail-header .avatar { width: 56px; height: 56px; font-size: 1.2rem; }
.detail-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }
.detail-subtitle { font-size: 0.95rem; color: var(--color-text-light); }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }

/* Info Grid */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.info-item { background: var(--color-white); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); }
.info-item__label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-light); margin-bottom: 4px; }
.info-item__value { font-size: 1.1rem; font-weight: 600; color: var(--color-text); }
.info-item__value.editable { display: flex; align-items: center; gap: 8px; }
.info-item__value input { width: 80px; padding: 4px 8px; font-family: var(--font-body); font-size: 1rem; font-weight: 600; border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); text-align: center; }
.info-item__value input:focus { outline: none; border-color: var(--color-primary); }

/* Score Badge */
.score-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.85rem; font-weight: 700; }
.score-badge.good { background: rgba(45, 138, 110, 0.1); color: var(--color-success); }
.score-badge.mediocre { background: rgba(224, 123, 76, 0.1); color: var(--color-warning); }
.score-badge.poor { background: rgba(220, 53, 69, 0.1); color: var(--color-error); }

/* Empty State */
.empty-state { text-align: center; padding: 48px 24px; color: var(--color-text-light); }

/* Back Link */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text-light); font-size: 0.9rem; margin-bottom: 16px; transition: color 0.2s; }
.back-link:hover { color: var(--color-primary); }
.back-link svg { width: 16px; height: 16px; fill: currentColor; }

/* Login Styles */
.login-container { width: 100%; max-width: 420px; padding: 24px; }
.login-card { background: var(--color-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 40px; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.login-logo__icon { width: 44px; height: 44px; background: var(--color-primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.login-logo__icon span { color: var(--color-white); font-weight: 700; font-size: 0.95rem; }
.login-logo__text { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--color-primary); }
.login-logo__badge { font-size: 0.6rem; background: var(--color-text); color: white; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.btn-google { width: 100%; padding: 12px 16px; border: 1.5px solid var(--color-border); background: var(--color-white); border-radius: var(--radius-md); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--font-body); font-size: 0.95rem; font-weight: 500; color: var(--color-text); transition: all 0.2s; }
.btn-google:hover { background: var(--color-cream); border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
.error-message { color: var(--color-error); font-size: 0.85rem; margin-top: 16px; display: none; padding: 10px 14px; background: rgba(220, 53, 69, 0.08); border-radius: var(--radius-sm); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .page-loading { left: 0; }
}
