/* Handaa — Warm Financial Dashboard Theme */

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

:root {
    --bg-page: #f4f1ed;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #faf8f6;
    --bg-input: #f7f5f2;
    --primary: #c4775c;
    --primary-dark: #a8614a;
    --primary-light: #d9967f;
    --primary-bg: rgba(196, 119, 92, 0.08);
    --primary-border: rgba(196, 119, 92, 0.2);
    --text: #1a1a1a;
    --text-secondary: #3d3d3d;
    --text-muted: #8a8a8a;
    --border: #e8e4e0;
    --border-light: #f0ece8;
    --danger: #c0392b;
    --warning: #d4a017;
    --success: #27ae60;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* =================== LAYOUT =================== */
.app-header { display: none; }

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* =================== SIDEBAR =================== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    padding: 28px 24px 24px;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.sidebar-logo-icon {
    width: 38px;
    height: 38px;
    background: var(--text);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #ffffff;
    font-weight: 800;
}

.sidebar-user {
    padding: 16px 24px 20px;
    margin: 0 16px;
    background: var(--bg-input);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #ffffff;
    flex-shrink: 0;
}

.sidebar-user-info {
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 4px;
}

.sidebar-section-title {
    padding: 12px 24px 6px;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    margin: 2px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.88rem;
    border-radius: 10px;
}

.sidebar-nav a:hover {
    background: var(--bg-input);
    color: var(--text);
}

.sidebar-nav a.active {
    background: var(--text);
    color: #ffffff;
}

.sidebar-nav a .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.92rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 24px 24px;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(192, 57, 43, 0.06);
    color: var(--danger);
    border-color: rgba(192, 57, 43, 0.25);
}

/* =================== MAIN CONTENT =================== */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--bg-page);
    min-width: 0;
}

/* =================== PAGE HEADER =================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* =================== DASHBOARD =================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: var(--primary-bg);
    border-radius: 0 0 0 60px;
}

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

.stat-card h3 {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* =================== CARDS =================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* =================== MENU GRID =================== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.menu-item {
    background: var(--bg-input);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: all 0.25s ease;
}

.menu-item:hover {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.menu-item h3 {
    color: var(--text);
    margin-bottom: 6px;
    font-size: 0.95rem;
    font-weight: 600;
}

.menu-item p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.menu-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* =================== FORMS =================== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
    background: #fff;
}

.form-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =================== BUTTONS =================== */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--text);
    color: #ffffff;
}

.btn-primary:hover {
    background: #333;
    color: #ffffff;
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-block {
    width: 100%;
    text-align: center;
}

/* =================== ALERTS =================== */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(192, 57, 43, 0.08);
    color: #922b21;
    border: 1px solid rgba(192, 57, 43, 0.2);
}

.alert-success {
    background: rgba(39, 174, 96, 0.08);
    color: #1e8449;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.alert-warning {
    background: rgba(212, 160, 23, 0.08);
    color: #9a7d0a;
    border: 1px solid rgba(212, 160, 23, 0.2);
}

/* =================== TABLE =================== */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

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

table th,
table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

table th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table tbody tr {
    transition: background 0.15s;
}

table tbody tr:hover {
    background: var(--bg-card-hover);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* =================== PERMISSIONS =================== */
.permission-role-badge {
    display: inline-block;
    margin-bottom: 16px;
    padding: 6px 14px;
    background: var(--primary-bg);
    border: 1px solid var(--primary-border);
    border-radius: 20px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.permission-item:hover {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.permission-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.permission-item span {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.88rem;
}

/* =================== PRODUCT FORM =================== */
.product-form-layout {
    display: flex;
    gap: 28px;
    margin-bottom: 24px;
}

.product-form-fields {
    flex: 1;
    min-width: 0;
}

.form-label-above {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* =================== IMAGE UPLOAD =================== */
.image-upload-section {
    flex-shrink: 0;
    width: 140px;
}

.image-preview {
    position: relative;
    width: 140px;
    height: 140px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.25s;
    background: var(--bg-input);
}

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

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 6px;
    padding: 12px;
}

.placeholder-svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    opacity: 0.4;
    transition: all 0.2s;
}

.image-preview:hover .placeholder-svg {
    opacity: 0.7;
    color: var(--primary);
}

.placeholder-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.2s;
}

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

.placeholder-hint {
    font-size: 0.62rem;
    color: var(--text-muted);
    opacity: 0.6;
    text-align: center;
    line-height: 1.3;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(192, 57, 43, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.image-remove-btn:hover {
    background: rgba(146, 43, 33, 1);
    transform: scale(1.1);
}

.product-thumb {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-light);
}

.product-thumb-empty {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 10px;
    font-size: 1.1rem;
}

/* =================== LOGIN =================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-page);
    padding: 20px;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        padding: 20px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .product-form-layout {
        flex-direction: column;
        align-items: center;
    }
    .image-upload-section {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}
