/* =========================================================
   Rent Manager - "PropMaster" style theme
   ---------------------------------------------------------
   Plain CSS only (no Tailwind, no external libraries) - a light
   slate/indigo look lifted from the hero-banner.png design
   reference (soft blue-grey background, white cards, navy
   text) while keeping our existing simple multi-page
   Flask/Jinja structure.
   ========================================================= */

* { box-sizing: border-box; }

:root {
    --bg-grad-start: #eef2f6;
    --bg-grad-mid:   #e7ecf3;
    --bg-grad-end:   #eef2f6;

    --panel-bg:   #ffffff;
    --panel-bg-strong: #ffffff;
    --border:     #e2e8f0;                  /* slate-200 */
    --border-soft: rgba(100, 116, 139, 0.15);

    --text-main:  #1e293b;   /* slate-800 */
    --text-muted: #64748b;   /* slate-500 */

    --indigo:      #4f46e5;
    --indigo-dark: #4338ca;
    --indigo-soft: rgba(99, 102, 241, 0.1);

    --success-text: #059669; --success-bg: rgba(5, 150, 105, 0.1);  --success-border: rgba(5, 150, 105, 0.2);
    --danger-text:  #e11d48; --danger-bg:  rgba(225, 29, 72, 0.08);  --danger-border:  rgba(225, 29, 72, 0.2);
    --warning-text: #d97706; --warning-bg: rgba(217, 119, 6, 0.1);   --warning-border: rgba(217, 119, 6, 0.2);
    --info-text:    #4338ca; --info-bg:    rgba(99, 102, 241, 0.1);  --info-border:    rgba(99, 102, 241, 0.2);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, Segoe UI, Arial, Helvetica, sans-serif;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--bg-grad-start), var(--bg-grad-mid) 55%, var(--bg-grad-end));
}

/* ---------- App shell: sidebar + main content ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--panel-bg-strong);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px -8px rgba(30, 41, 59, 0.15);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo-badge {
    background: var(--indigo);
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
}

.sidebar-brand .logo-badge img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.sidebar-brand .brand-title {
    color: var(--text-main);
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}

.sidebar-brand .brand-subtitle {
    color: var(--text-muted);
    font-size: 11px;
}

.sidebar-nav {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
    background: var(--indigo-soft);
    color: var(--indigo-dark);
}

.sidebar-nav a.active {
    background: var(--indigo);
    color: white;
    box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.5);
}

.sidebar-nav a .icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 56px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    background: var(--panel-bg);
    display: flex;
    align-items: center;
    padding: 0 28px;
}

.topbar h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.container {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 28px;
}

h1 {
    margin: 0 0 20px 0;
    color: var(--text-main);
    font-size: 24px;
}

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

.card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 20px;
    box-shadow: 0 8px 20px -12px rgba(30, 41, 59, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card .card-icon {
    background: var(--indigo-soft);
    color: var(--indigo-dark);
    border: 1px solid var(--info-border);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.card h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

.card p {
    margin: 4px 0 0 0;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---------- Buttons ---------- */
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    background: var(--indigo);
    color: white;
    padding: 11px 20px;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.6);
    transition: background 0.15s, transform 0.1s;
}

.btn:hover { background: var(--indigo-dark); }
.btn:active { transform: scale(0.98); }

.btn-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-main);
    box-shadow: none;
    margin-left: 10px;
}

.btn-secondary:hover { background: rgba(100, 116, 139, 0.18); }

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.btn-danger:hover { background: rgba(244, 63, 94, 0.22); }

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 20px -12px rgba(30, 41, 59, 0.12);
}

th, td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

td { color: var(--text-main); }

tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Status pills (reused via inline classes if needed) ---------- */
.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
}

.pill-success { color: var(--success-text); background: var(--success-bg); border-color: var(--success-border); }
.pill-danger  { color: var(--danger-text);  background: var(--danger-bg);  border-color: var(--danger-border); }
.pill-warning { color: var(--warning-text); background: var(--warning-bg); border-color: var(--warning-border); }

/* ---------- Forms ---------- */
.form-card {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 20px -12px rgba(30, 41, 59, 0.12);
    max-width: 420px;
    display: flex;
    flex-direction: column;
}

/* Some pages (e.g. verify.html) put .form-card on a wrapper div around
   the <form> rather than on the <form> itself - keep label/input stacked
   vertically in that case too, instead of the browser's default inline
   flow (which wraps a long label sideways next to the textarea). */
.form-card form {
    display: flex;
    flex-direction: column;
}

.form-card label {
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.form-card input,
.form-card select,
.form-card textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: #f8fafc;
    color: var(--text-main);
}

.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

.form-card select option { background: #ffffff; color: var(--text-main); }

.form-card small {
    color: var(--text-muted);
    margin-top: 4px;
}

.form-card .btn {
    margin-top: 22px;
    width: fit-content;
}

/* ---------- Receipt ----------
   Deliberately kept light/"paper" styled (unlike the rest of the dark
   dashboard) since a receipt is a printable document people expect to
   look like paper, styled after the Canva receipt-template design. */
.receipt {
    position: relative;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 34px;
    border-radius: 16px;
    max-width: 460px;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
}

.receipt::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('icon.png');
    background-repeat: no-repeat;
    background-position: center 60%;
    background-size: 220px;
    opacity: 0.06;
    z-index: 0;
}

.receipt > * {
    position: relative;
    z-index: 1;
}

.receipt h1 {
    margin-top: 0;
    color: var(--indigo-dark);
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 14px;
}

.receipt p {
    margin: 10px 0;
    color: #1e293b;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 8px;
}

.receipt p strong { color: #64748b; font-weight: 600; margin-right: 6px; }
.receipt .btn { box-shadow: none; }

/* The receipt is already light/paper-styled on screen (see above), so
   printing just needs to hide the app chrome around it. */
@media print {
    body { background: white !important; }
    .sidebar, .topbar, .flash, .btn { display: none !important; }
    .container { padding: 0; }
    .receipt { box-shadow: none !important; border-color: #ccc !important; }
}

/* ---------- Flash messages ---------- */
.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
}

.flash-success { color: var(--success-text); background: var(--success-bg); border-color: var(--success-border); }
.flash-danger  { color: var(--danger-text);  background: var(--danger-bg);  border-color: var(--danger-border); }
.flash-info    { color: var(--info-text);    background: var(--info-bg);    border-color: var(--info-border); }

/* ---------- Login page ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-logo-plate {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px -12px rgba(30, 41, 59, 0.15);
}

.login-logo-plate img {
    width: 150px;
    max-width: 100%;
    display: block;
}

/* ---------- Dashboard hero banner ----------
   Capped width (rather than stretching full-bleed across the
   container) so it reads as a compact badge instead of dominating
   the page - full aspect ratio kept intact so its text never crops. */
.hero-banner {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
    max-width: 360px;
    box-shadow: 0 8px 20px -12px rgba(30, 41, 59, 0.15);
    border: 1px solid var(--border);
}

.hero-banner img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- Responsive: stack sidebar on top for small screens ---------- */
@media (max-width: 760px) {
    .app-shell { flex-direction: column; }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-brand { border-bottom: none; }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0 16px 16px 16px;
    }

    .sidebar-footer { display: none; }

    .container { padding: 20px; }
}
