@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800;900&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css');

:root {
    --primary: #1e293b;
    --primary-light: #334155;
    --accent: #2563eb;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --border: #e2e8f0;
}

* {
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    color: var(--text-main);
}

/* HEADER */
header {
    background: var(--primary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header-title {
    font-size: 20px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: white;
    cursor: pointer;
}

/* TABS */
.tab-container {
    display: flex;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 10px;
    overflow-x: auto;
}

.tab {
    padding: 15px 20px;
    font-weight: 800;
    color: var(--text-sub);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* PANELS */
.panel {
    display: none;
    padding: 20px;
}
.panel.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* CARDS & FORMS */
.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 15px 0;
    color: var(--primary);
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 15px;
    outline: none;
    margin-bottom: 15px;
    font-weight: 600;
    color: var(--text-main);
}
input:focus, select:focus {
    border-color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
}
.btn-primary:active { transform: scale(0.98); }

/* LISTS */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}

.list-item h4 { margin: 0; font-weight: 800; font-size: 16px; }
.list-item p { margin: 4px 0 0 0; font-size: 13px; color: var(--text-sub); }

.btn-small {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    border: none;
}
.btn-edit { background: #e0f2fe; color: #0284c7; }
.btn-assign { background: #dcfce7; color: #16a34a; }
.btn-delete { background: #fee2e2; color: #ef4444; }
.btn-backup { background: #f3e8ff; color: #9333ea; }
.btn-view { background: #fef9c3; color: #ca8a04; }
.btn-ledger { background: #dcfce7; color: #075e54; border-color: #075e54; }

/* MODALS */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-content {
    background: var(--surface);
    border-radius: 20px;
    width: 100%; max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-weight: 800; }
.modal-close { font-size: 24px; cursor: pointer; color: var(--text-sub); }
.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* DESIGN SELECTOR GRID */
.design-select-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.design-select-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: 0.2s;
}
.design-select-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
.design-select-card img {
    width: 100%; height: 80px; object-fit: cover;
}
.sel-info {
    padding: 6px; font-size: 11px; font-weight: 800; text-align: center;
}
.check-icon {
    position: absolute; top: 5px; right: 5px;
    background: var(--accent); color: white;
    border-radius: 50%; width: 20px; height: 20px;
    display: none; align-items: center; justify-content: center;
    font-size: 12px;
}
.design-select-card.selected .check-icon { display: flex; }

/* Dynamic Contact Inputs & File Uploads */
.contact-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; }
.contact-row input { margin-bottom: 0; }
.contact-tag { display: inline-flex; align-items: center; gap: 5px; background: #e0f2fe; color: #0284c7; padding: 5px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; margin: 0 5px 5px 0; }
.contact-tag i { cursor: pointer; color: red; font-size: 14px; }
.upload-btn-wrapper { position: relative; overflow: hidden; display: inline-block; width: 100%; margin-bottom: 15px; }
.upload-btn-wrapper button { width: 100%; padding: 12px; border-radius: 10px; border: 1px dashed var(--accent); background: #f8fafc; color: var(--accent); font-weight: bold; cursor: pointer; }
.upload-btn-wrapper input[type=file] { font-size: 100px; position: absolute; left: 0; top: 0; opacity: 0; cursor: pointer; height: 100%; }
.file-list { font-size: 13px; color: var(--text-sub); margin-bottom: 15px; word-break: break-all; }
.preview-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* Loading Overlay */
.loading-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); z-index: 2000; flex-direction: column; align-items: center; justify-content: center; color: white; }
.loading-overlay.active { display: flex; }
.progress-container { width: 80%; max-width: 400px; background: #334155; border-radius: 10px; height: 10px; overflow: hidden; margin: 20px 0; }
.progress-bar { width: 0%; height: 100%; background: var(--accent); transition: width 0.3s; }
.loading-status { font-size: 14px; font-weight: bold; color: #e2e8f0; text-align: center; }

/* Ledger WhatsApp Styles */
.ledger-msg { max-width: 85%; padding: 10px 15px; border-radius: 15px; margin-bottom: 10px; position: relative; word-break: break-word; font-size:14px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.ledger-msg.admin { background: #dcf8c6; align-self: flex-end; border-top-right-radius: 0; }
.ledger-time { font-size: 10px; color: rgba(0,0,0,0.5); text-align: right; margin-top: 5px; }
.ledger-media { max-width: 100%; max-height: 200px; border-radius: 8px; margin-bottom: 5px; object-fit: contain; cursor: pointer; }
