/* ============================================
   Gold Shop Management System - Main CSS
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #C9A961;
    --primary-dark: #A88A4A;
    --primary-light: #E5D5A8;
    --secondary: #2C3E50;
    --success: #27AE60;
    --danger: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;
    --light: #F8F9FA;
    --dark: #1A1D23;
    --gray: #6C757D;
    --gray-light: #E9ECEF;
    --border: #DEE2E6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

body {
    font-family: 'Sarabun', 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #F4F6F8;
    color: var(--dark);
    line-height: 1.6;
    font-size: 14px;
}

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

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--dark) 100%);
    color: #fff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h2 {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 700;
}

.sidebar-header p {
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    margin-top: 4px;
}

.sidebar-user {
    padding: 16px 20px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user .user-name {
    font-weight: 600;
    color: var(--primary-light);
}

.sidebar-user .user-role {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(201,169,97,0.15);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-menu .icon {
    width: 22px;
    margin-right: 12px;
    text-align: center;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 0;
    width: calc(100% - 260px);
}

.topbar {
    background: #fff;
    padding: 14px 24px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 {
    font-size: 1.3rem;
    color: var(--dark);
}

.topbar .gold-price-mini {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
}

.gold-price-mini .price-item {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 500;
}

.content {
    padding: 24px;
}

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--dark);
}

.card-body {
    padding: 20px;
}

/* ===== Stats Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card .label {
    color: var(--gray);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-card .sub {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 4px;
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-card.info    { border-left-color: var(--info); }
.stat-card.warning { border-left-color: var(--warning); }

/* ===== Form ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201,169,97,0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201,169,97,0.4);
}

.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-info    { background: var(--info); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-secondary { background: var(--gray); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.table thead th {
    background: #F8F9FA;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
}

.table tbody tr:hover {
    background: #FAFBFC;
}

.table .text-right { text-align: right; }
.table .text-center { text-align: center; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success { background: #D4EDDA; color: #155724; }
.badge-danger  { background: #F8D7DA; color: #721C24; }
.badge-warning { background: #FFF3CD; color: #856404; }
.badge-info    { background: #D1ECF1; color: #0C5460; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success { background: #D4EDDA; border-color: var(--success); color: #155724; }
.alert-danger  { background: #F8D7DA; border-color: var(--danger); color: #721C24; }
.alert-warning { background: #FFF3CD; border-color: var(--warning); color: #856404; }
.alert-info    { background: #D1ECF1; border-color: var(--info); color: #0C5460; }

/* ===== Login Page ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1A1D23 0%, #2C3E50 100%);
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 16px;
}

.login-header h1 {
    color: var(--dark);
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--gray);
    font-size: 0.9rem;
}

/* ===== Image preview ===== */
.image-preview {
    width: 100%;
    min-height: 150px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FAFBFC;
    margin-top: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.image-preview:hover {
    border-color: var(--primary);
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.image-preview .placeholder {
    color: var(--gray);
    text-align: center;
    padding: 30px;
}

/* ===== Gold Price Banner ===== */
.gold-price-banner {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    box-shadow: var(--shadow-lg);
}

.price-block {
    text-align: center;
}

.price-block .label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.price-block .price {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 4px;
}

.price-block .updated {
    font-size: 0.7rem;
    opacity: 0.8;
    margin-top: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .form-row.cols-2,
    .form-row.cols-3,
    .form-row.cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ===== Signature Pad ===== */
.signature-pad {
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: crosshair;
    width: 100%;
    height: 150px;
}

.signature-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

/* ===== Utility ===== */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-muted   { color: var(--gray); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
