/* ============================================================
   KPMG Presentate — Main Stylesheet
   Brand: #00338D Blue | Open Sans Condensed (titles) | Open Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Open+Sans+Condensed:wght@300;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --kpmg-blue:     #00338D;
  --kpmg-cobalt:   #1E49E2;
  --kpmg-dark:     #0C233C;
  --kpmg-light:    #F2F5FA;
  --kpmg-border:   #D0D8E8;
  --kpmg-gray:     #6B7A8D;
  --kpmg-success:  #1A7F5A;
  --kpmg-error:    #C0392B;
  --kpmg-warning:  #D4A017;
  --white:         #FFFFFF;
  --text:          #1A2535;
  --text-muted:    #6B7A8D;

  --font-title: 'Open Sans Condensed', 'Arial Narrow', sans-serif;
  --font-body:  'Open Sans', Arial, sans-serif;

  --radius:  4px;
  --radius-lg: 8px;
  --shadow:  0 2px 12px rgba(0,51,141,0.10);
  --shadow-lg: 0 8px 32px rgba(0,51,141,0.16);
  --transition: 0.18s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--kpmg-light);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--kpmg-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── Layout ────────────────────────────────────────────────── */
.app-wrapper   { display: flex; min-height: 100vh; }
.sidebar       { width: 240px; background: var(--kpmg-dark); flex-shrink: 0;
                 display: flex; flex-direction: column; position: fixed;
                 top: 0; left: 0; height: 100vh; z-index: 100; }
.main-content  { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar        { background: var(--white); border-bottom: 1px solid var(--kpmg-border);
                 padding: 0 32px; height: 60px; display: flex; align-items: center;
                 justify-content: space-between; position: sticky; top: 0; z-index: 50;
                 box-shadow: var(--shadow); }
.page-body     { padding: 32px; flex: 1; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar-logo  { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo img { height: 36px; object-fit: contain; }
.sidebar-logo .logo-text {
  color: var(--white);
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.sidebar-logo .logo-sub  { color: rgba(255,255,255,0.45); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav   { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section   { padding: 12px 20px 4px; color: rgba(255,255,255,0.3); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
.nav-item      { display: flex; align-items: center; gap: 10px; padding: 10px 20px;
                 color: rgba(255,255,255,0.7); font-size: 14px; cursor: pointer;
                 transition: all var(--transition); border-left: 3px solid transparent; }
.nav-item:hover, .nav-item.active {
  background: rgba(0,51,141,0.4);
  color: var(--white);
  border-left-color: var(--kpmg-blue);
  text-decoration: none;
}
.nav-item svg  { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-user   { display: flex; align-items: center; gap: 10px; }
.avatar         { width: 34px; height: 34px; border-radius: 50%; background: var(--kpmg-blue);
                  display: flex; align-items: center; justify-content: center;
                  color: var(--white); font-size: 13px; font-weight: 700; flex-shrink: 0; }
.sidebar-user-name { color: var(--white); font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: rgba(255,255,255,0.4); font-size: 11px; }

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar-title { font-family: var(--font-title); font-size: 20px; font-weight: 700; color: var(--kpmg-dark); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.lang-switch { display: flex; gap: 4px; }
.lang-btn { padding: 4px 10px; border: 1px solid var(--kpmg-border); border-radius: var(--radius);
            font-size: 12px; cursor: pointer; background: transparent; color: var(--text-muted); }
.lang-btn.active { background: var(--kpmg-blue); color: white; border-color: var(--kpmg-blue); }

/* ── Cards ─────────────────────────────────────────────────── */
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow);
        border: 1px solid var(--kpmg-border); overflow: hidden; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--kpmg-border);
               display: flex; align-items: center; justify-content: space-between; }
.card-title  { font-family: var(--font-title); font-size: 18px; font-weight: 700; color: var(--kpmg-dark); }
.card-body   { padding: 24px; }

.card-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.project-card { transition: transform var(--transition), box-shadow var(--transition); cursor: pointer; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.project-card-top { background: var(--kpmg-blue); padding: 20px 24px; }
.project-card-top h3 { color: var(--white); font-family: var(--font-title); font-size: 18px; font-weight: 700; }
.project-card-meta { display: flex; gap: 16px; margin-top: 8px; }
.meta-badge { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); padding: 2px 8px; border-radius: 12px; font-size: 11px; }
.project-card-body { padding: 16px 24px; }
.project-card-desc { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.project-card-footer { padding: 12px 24px; border-top: 1px solid var(--kpmg-border);
                       display: flex; align-items: center; justify-content: space-between; }
.project-card-date { color: var(--text-muted); font-size: 12px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px;
       border-radius: var(--radius); font-family: var(--font-body); font-size: 14px;
       font-weight: 600; cursor: pointer; border: none; transition: all var(--transition);
       text-decoration: none; white-space: nowrap; }
.btn-primary  { background: var(--kpmg-blue); color: var(--white); }
.btn-primary:hover { background: #002878; color: var(--white); text-decoration: none; }
.btn-secondary { background: transparent; color: var(--kpmg-blue); border: 1.5px solid var(--kpmg-blue); }
.btn-secondary:hover { background: var(--kpmg-blue); color: var(--white); }
.btn-dark   { background: var(--kpmg-dark); color: var(--white); }
.btn-danger { background: var(--kpmg-error); color: var(--white); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn svg { width: 16px; height: 16px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group  { margin-bottom: 20px; }
.form-label  { display: block; font-weight: 600; font-size: 13px; color: var(--kpmg-dark);
               margin-bottom: 6px; }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--kpmg-border);
                border-radius: var(--radius); font-family: var(--font-body); font-size: 14px;
                color: var(--text); background: var(--white); transition: border-color var(--transition);
                outline: none; }
.form-control:focus { border-color: var(--kpmg-blue); box-shadow: 0 0 0 3px rgba(0,51,141,0.10); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
select.form-control { cursor: pointer; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.alert-error   { background: #FDECEA; color: #922B21; border-left: 4px solid var(--kpmg-error); }
.alert-success { background: #E8F5F0; color: #1A5C3A; border-left: 4px solid var(--kpmg-success); }
.alert-info    { background: #EBF0FB; color: #1A3A7A; border-left: 4px solid var(--kpmg-blue); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: var(--kpmg-dark); color: var(--white); padding: 12px 16px; text-align: left;
     font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid var(--kpmg-border); font-size: 14px; vertical-align: middle; }
tr:hover td { background: var(--kpmg-light); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-admin   { background: #EBF0FB; color: var(--kpmg-blue); }
.badge-user    { background: #F0F0F0; color: var(--text-muted); }
.badge-active  { background: #E8F5F0; color: var(--kpmg-success); }
.badge-inactive{ background: #FDECEA; color: var(--kpmg-error); }
.badge-ready   { background: #E8F5F0; color: var(--kpmg-success); }
.badge-draft   { background: #F5F0E8; color: #8B6914; }
.badge-generating { background: #EBF0FB; color: var(--kpmg-blue); }
.badge-error   { background: #FDECEA; color: var(--kpmg-error); }

/* ── Stats / KPI ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card  { background: var(--white); border-radius: var(--radius-lg); padding: 24px;
              border: 1px solid var(--kpmg-border); border-top: 4px solid var(--kpmg-blue); }
.stat-value { font-family: var(--font-title); font-size: 36px; font-weight: 700; color: var(--kpmg-dark); line-height: 1; }
.stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Auth Pages ────────────────────────────────────────────── */
.auth-page  { min-height: 100vh; display: flex; align-items: center; justify-content: center;
              background: linear-gradient(135deg, var(--kpmg-dark) 0%, var(--kpmg-blue) 100%); }
.auth-card  { background: var(--white); border-radius: var(--radius-lg); padding: 48px;
              width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-logo  { text-align: center; margin-bottom: 32px; }
.auth-logo img { height: 44px; margin: 0 auto; }
.auth-logo-text { font-family: var(--font-title); font-size: 26px; font-weight: 700;
                  color: var(--kpmg-blue); letter-spacing: 0.5px; margin-top: 8px; }
.auth-logo-sub  { color: var(--text-muted); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; }
.auth-title { font-family: var(--font-title); font-size: 22px; font-weight: 700;
              color: var(--kpmg-dark); margin-bottom: 24px; text-align: center; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-muted); }

/* ── Presentation Editor ───────────────────────────────────── */
.editor-layout    { display: flex; height: calc(100vh - 60px); overflow: hidden; }
.editor-sidebar   { width: 280px; border-right: 1px solid var(--kpmg-border); background: var(--white);
                    display: flex; flex-direction: column; overflow: hidden; }
.editor-main      { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #E8ECF3; }
.editor-toolbar   { background: var(--white); border-bottom: 1px solid var(--kpmg-border);
                    padding: 12px 20px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.slide-preview-area { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.slide-list  { flex: 1; overflow-y: auto; padding: 12px; }
.slide-thumb { background: var(--white); border: 2px solid var(--kpmg-border); border-radius: var(--radius);
               padding: 8px; cursor: pointer; margin-bottom: 8px; position: relative;
               transition: border-color var(--transition); }
.slide-thumb:hover, .slide-thumb.active { border-color: var(--kpmg-blue); }
.slide-thumb-num { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.slide-thumb-title { font-size: 12px; font-weight: 600; color: var(--kpmg-dark);
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-thumb-layout { font-size: 10px; color: var(--text-muted); text-transform: capitalize; }

/* Slide preview canvas */
.slide-canvas { background: white; border-radius: var(--radius); box-shadow: var(--shadow-lg);
                aspect-ratio: 16/9; width: 100%; max-width: 900px; position: relative;
                overflow: hidden; font-family: var(--font-body); }

/* ── AI Generate Panel ─────────────────────────────────────── */
.gen-panel  { background: var(--white); border-top: 1px solid var(--kpmg-border); padding: 16px;
              flex-shrink: 0; }
.gen-panel h4 { font-family: var(--font-title); font-size: 15px; font-weight: 700;
                color: var(--kpmg-dark); margin-bottom: 10px; }

/* ── Loading / Spinner ─────────────────────────────────────── */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid rgba(0,51,141,0.2);
           border-top-color: var(--kpmg-blue); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay { position: fixed; inset: 0; background: rgba(12,35,60,0.7);
                   display: flex; flex-direction: column; align-items: center; justify-content: center;
                   z-index: 999; gap: 16px; }
.loading-overlay .spinner { width: 44px; height: 44px; border-width: 4px; border-color: rgba(255,255,255,0.2); border-top-color: white; }
.loading-overlay p { color: white; font-size: 16px; font-family: var(--font-body); }

/* ── Modals ────────────────────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12,35,60,0.5); z-index: 200;
                  display: flex; align-items: center; justify-content: center; }
.modal  { background: var(--white); border-radius: var(--radius-lg); padding: 32px;
          max-width: 540px; width: 100%; box-shadow: var(--shadow-lg); position: relative; }
.modal h2 { font-family: var(--font-title); font-size: 22px; font-weight: 700; color: var(--kpmg-dark); margin-bottom: 20px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none;
               cursor: pointer; color: var(--text-muted); font-size: 20px; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--kpmg-border); margin-bottom: 24px; }
.tab  { padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 600;
        color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px;
        transition: all var(--transition); }
.tab:hover, .tab.active { color: var(--kpmg-blue); border-bottom-color: var(--kpmg-blue); }

/* ── Page header ───────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.page-header h1 { font-family: var(--font-title); font-size: 28px; font-weight: 700; color: var(--kpmg-dark); }
.page-header p  { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--kpmg-blue); }
.breadcrumb span { color: var(--text-muted); }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 32px; }
.empty-state svg { width: 64px; height: 64px; color: var(--kpmg-border); margin: 0 auto 16px; }
.empty-state h3 { font-family: var(--font-title); font-size: 20px; color: var(--kpmg-dark); margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar    { width: 200px; }
  .main-content { margin-left: 200px; }
}
@media (max-width: 768px) {
  .sidebar    { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .form-row   { grid-template-columns: 1fr; }
  .page-body  { padding: 20px; }
}

/* ── Slide preview renderers (HTML live preview) ───────────── */
.sp-title-slide    { background: var(--kpmg-blue); color: white; height: 100%; }
.sp-content-slide  { background: white; height: 100%; }
.sp-dark-slide     { background: var(--kpmg-dark); color: white; height: 100%; }
.sp-footer         { position: absolute; bottom: 0; left: 0; right: 0; background: var(--kpmg-dark);
                     padding: 4px 16px; font-size: 6px; color: #888; font-family: var(--font-body); }
.sp-top-bar        { position: absolute; top: 0; left: 0; right: 0; height: 6px; background: var(--kpmg-blue); }
.sp-sidebar-accent { position: absolute; top: 6px; left: 0; bottom: 40px; width: 10px; background: var(--kpmg-blue); }
.sp-title          { font-family: var(--font-title); font-weight: 700; }
