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

:root {
    --primary: #8b5cf6;       /* Primary purple from screenshots */
    --primary-hover: #7c3aed;
    --primary-light: #ede9fe;
    --bg: #f8fafc;            /* Light gray background */
    --surface: #ffffff;       /* Pure white cards */
    --sidebar-bg: #ffffff;    /* Light sidebar */
    --sidebar-text: #475569;
    --sidebar-hover: #f1f5f9;
    --sidebar-active: #8b5cf6;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --radius: 8px;            /* Softer border radius */
    --radius-sm: 4px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-hover: #475569;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app { display: grid; grid-template-columns: 240px 1fr; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar { background: var(--sidebar-bg); display: flex; flex-direction: column; color: var(--sidebar-text); border-right: 1px solid var(--border); }
.brand { padding: 1.5rem 1.5rem; font-weight: 700; font-size: 16px; color: var(--text-main); letter-spacing: 0.5px; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.brand::before { content: '🏦'; font-size: 20px; }
.nav { display: flex; flex-direction: column; gap: 0.2rem; padding: 0 1rem; }
.nav-item { padding: 0.6rem 1rem; color: var(--sidebar-text); text-decoration: none; cursor: pointer; border-radius: var(--radius); transition: all 0.2s ease; font-weight: 500; font-size: 13px; }
.nav-item:hover { background: var(--sidebar-hover); }
.nav-item.active { color: var(--sidebar-active); font-weight: 600; background: var(--primary-light); }
.nav-group-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; padding: 1.5rem 1rem 0.5rem; }

/* Main Area */
.main { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: 56px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 1.5rem; background: var(--surface); z-index: 10; }
.topbar .left { display: flex; align-items: center; color: var(--text-muted); cursor: pointer; }

.viewport { flex: 1; overflow-y: auto; padding: 2rem; }
.page { display: none; }
.page.active { display: block; animation: fade-in 0.2s ease-out forwards; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Typography */
h1 { font-size: 24px; font-weight: 600; color: var(--text-main); margin-bottom: 1.5rem; }
h2 { font-size: 16px; font-weight: 600; color: var(--text-main); margin: 2rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }

/* Buttons */
.btn { font-family: inherit; font-size: 13px; font-weight: 500; padding: 0.5rem 1.25rem; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.2s; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow); }
.btn-outline { background: var(--surface); color: var(--text-main); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); border-color: var(--border-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-main); background: var(--bg); }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.stat-box { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); border-top: 3px solid var(--primary); }
.stat-lbl { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-val { font-size: 28px; font-weight: 700; color: var(--text-main); }

/* Forms & Filters */
.toolbar { display: flex; gap: 1rem; margin-bottom: 1.5rem; align-items: flex-end; background: var(--surface); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.input-group { display: flex; flex-direction: column; gap: 0.4rem; }
.input-group label { font-size: 12px; font-weight: 600; color: var(--text-main); }
input, select { background: var(--surface); color: var(--text-main); border: 1px solid var(--border); padding: 0.5rem 0.75rem; font-family: inherit; font-size: 13px; border-radius: var(--radius-sm); outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }

/* Radio Options */
.radio-options { display: flex; gap: 1.5rem; padding: 0.5rem 0; }
.radio-options label { font-size: 13px !important; color: var(--text-main) !important; font-weight: 400 !important; display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
input[type="radio"] { cursor: pointer; }

/* Tables */
.table-wrapper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 1rem 1.5rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }
.link-cell { color: var(--primary); cursor: pointer; font-weight: 500; }
.link-cell:hover { text-decoration: underline; }
.text-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.tag { display: inline-flex; padding: 0.25rem 0.6rem; font-size: 11px; font-weight: 600; border-radius: 4px; background: #e0e7ff; color: #4338ca; border: 1px solid #c7d2fe; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; padding: 1rem; gap: 1rem; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.page-btn { padding: 0.2rem 0.6rem; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.action-link { color: var(--primary); cursor: pointer; font-size: 13px; text-decoration: none; margin-right: 0.5rem; }
.action-link:hover { text-decoration: underline; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 2rem; gap: 2rem; padding: 0 1rem; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; }
.tab { padding: 1rem 0; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; font-size: 14px; font-weight: 500; transition: all 0.2s; margin-bottom: -1px; }
.tab:hover { color: var(--text-main); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; background: var(--surface); padding: 2rem; border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); margin-top: -2rem; box-shadow: var(--shadow); }
.tab-content.active { display: block; animation: fade-in 0.2s ease-out forwards; }

/* Forms Grid */
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem; }
.req { color: #dc2626; margin-right: 2px; }

/* Photos Layout */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1.5rem; }
.upload-group { display: flex; align-items: center; justify-content: space-between; background: var(--bg); padding: 1.25rem; border-radius: var(--radius); border: 1px solid var(--border); gap: 1rem; transition: box-shadow 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.upload-group:hover { box-shadow: var(--shadow-md); border-color: var(--border-hover); }
.upload-group label { flex: 1; font-weight: 600; font-size: 13px; color: var(--text-main); line-height: 1.4; }
.upload-area { width: 140px; height: 100px; border: 1px dashed var(--border-hover); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; border-radius: var(--radius-sm); transition: all 0.2s; position: relative; overflow: hidden; flex-shrink: 0; }
.upload-area:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.upload-area i.fa-arrow-up-from-bracket { font-size: 24px; color: #94a3b8; }
.upload-area:hover i.fa-arrow-up-from-bracket { color: var(--primary); }

.upload-area img.preview-img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.upload-area .preview-pdf { font-size: 36px; color: #dc2626; }
.upload-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.7); color: white; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; font-weight: 500; font-size: 13px; cursor: pointer; }
.upload-area:hover .upload-overlay { opacity: 1; }

/* Open Design Modern UI Components */
.modern-list { display: flex; flex-direction: column; }
.modern-card { background: var(--surface); border-radius: 12px; border: 1px solid var(--border); padding: 1.5rem; display: flex; align-items: center; justify-content: space-between; transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.02); gap: 1.5rem; }
.modern-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-hover); }

/* Borderless Modern Row for High-Density Lists */
.modern-row { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); transition: background 0.2s; }
.modern-row:hover { background: rgba(139, 92, 246, 0.03); }
.modern-row:last-child { border-bottom: none; }
.id-link { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; transition: opacity 0.2s; }
.id-link:hover { opacity: 0.8; text-decoration: underline; }

.mc-col { display: flex; flex-direction: column; gap: 0.2rem; }
.mc-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.mc-val { font-size: 14px; font-weight: 500; color: var(--text-main); }
.mc-val.amount { font-family: monospace; font-size: 15px; font-weight: 600; color: #15803d; }

.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.75rem; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-yellow { background: #fef08a; color: #854d0e; border: 1px solid #fde047; }
.badge-purple { background: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }

/* Open Design Detail View Blocks */
.info-block-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.info-block { background: var(--bg); border: 1px solid var(--border); padding: 1.25rem; border-radius: 12px; display: flex; align-items: flex-start; gap: 1rem; transition: background 0.2s; }
.info-block:hover { background: var(--surface); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.info-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.info-content { display: flex; flex-direction: column; gap: 0.2rem; }
.info-title { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.info-data { font-size: 15px; font-weight: 600; color: var(--text-main); word-break: break-word; }

/* Open Design Form & Dashboard Components */
.form-card { background: var(--surface); padding: 2rem; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 2rem; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.form-card-title { font-size: 14px; font-weight: 600; color: var(--text-main); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; }
.form-card-title i { color: var(--primary); }

.dash-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; }
.dash-welcome h1 { font-size: 28px; margin-bottom: 0.2rem; }
.dash-welcome p { color: var(--text-muted); font-size: 14px; }

.trend-up { color: #15803d; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; background: #dcfce7; padding: 2px 6px; border-radius: 4px; }
.trend-down { color: #b91c1c; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; background: #fee2e2; padding: 2px 6px; border-radius: 4px; }

/* Dropdown Actions Menu */
.dropdown-wrapper { position: relative; display: inline-block; cursor: pointer; }
.dropdown-wrapper .action-dots { color: var(--primary); padding: 0.2rem 0.6rem; border-radius: 4px; font-weight: bold; font-size: 18px; line-height: 1; letter-spacing: 2px; }
.dropdown-wrapper:hover .action-dots { background: rgba(139, 92, 246, 0.1); }
.dropdown-menu {
    display: none; position: absolute; right: 0; top: 100%; min-width: 160px;
    background: white; border: 1px solid var(--border); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-radius: 6px; z-index: 100; padding: 0.5rem 0;
}
.dropdown-wrapper:hover .dropdown-menu { display: block; animation: fade-in 0.2s ease-out forwards; }
.dropdown-item { padding: 0.5rem 1rem; font-size: 13px; color: var(--text-main); display: block; text-decoration: none; transition: background 0.2s; white-space: nowrap; }
.dropdown-item:hover { background: rgba(0,0,0,0.03); text-decoration: none; }
.dropdown-item.disabled { color: #cbd5e1; pointer-events: none; }
.dropdown-item.danger { color: #ef4444; }
.dropdown-item.danger:hover { background: #fef2f2; }

/* Helpers */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-1 { margin-bottom: 1rem; }

/* Modal Styles */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.8); display: none; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.2s; }
.modal-overlay.active { display: flex; opacity: 1; }
.modal-content { background: var(--surface); padding: 1.5rem; border-radius: var(--radius); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); max-width: 900px; width: 90%; max-height: 90vh; display: flex; flex-direction: column; position: relative; }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: var(--surface); border: 1px solid var(--border); width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); z-index: 2; transition: all 0.2s; }
.modal-close:hover { background: var(--bg); color: var(--text-main); border-color: var(--border-hover); }
.modal-body { flex: 1; overflow: hidden; display: flex; justify-content: center; align-items: center; background: var(--bg); border-radius: var(--radius-sm); min-height: 400px; border: 1px solid var(--border); }
.modal-body img { max-width: 100%; max-height: calc(90vh - 4rem); object-fit: contain; }
.modal-body iframe { width: 100%; height: calc(90vh - 4rem); border: none; }
