/* assets/css/vendor.css */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white-color: #fff;
    --border-color: #dee2e6;
    --sidebar-bg: #212529;
    --sidebar-text: #adb5bd;
    --sidebar-active: var(--white-color);
    --sidebar-hover-bg: #343a40;
    --body-bg: #f4f7f6;
    --card-bg: var(--white-color);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --font-family: 'Poppins', sans-serif;
}

/* --- General & Reset --- */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--body-bg);
    color: var(--dark-color);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 1rem; font-weight: 600; }
a { text-decoration: none; color: var(--primary-color); transition: color 0.2s ease; }
a:hover { color: var(--primary-hover); }

/* --- Auth Pages (Login/Signup) --- */
.vendor-auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.vendor-auth-container {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin: 1rem;
}
.vendor-auth-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
    color: var(--dark-color);
}

.form-group { 
    margin-bottom: 1.5rem; 
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

#category_id {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 8px;
    background: var(--bg-secondary, #fff);
    font-size: 1rem;
    transition: border-color 0.2s;
    outline: none;
    min-width: 200px;
    max-width: 100%;
    box-sizing: border-box;
}

#category_id:focus {
    border-color: var(--primary-red, #007bff);
    background: var(--hover-bg, #f0f0f0);
}

.form-group select:disabled {
    background: #eee;
    color: #888;
}

.auth-btn {
    width: 100%;
    padding: 0.85rem;
    background-color: var(--primary-color);
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}
.auth-btn:hover { background-color: var(--primary-hover); }
.auth-link-text { text-align: center; margin-top: 1.5rem; font-size: 0.9rem; }


/* --- Vendor Panel Layout --- */
.vendor-wrapper {
    display: flex;
    position: relative; 
}

.vendor-sidebar {
    width: 250px; 
    flex-shrink: 0; 
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
}

.vendor-main-content {
    margin-left: 250px; 
    flex-grow: 1; 
    width: calc(100% - 250px);
    transition: margin-left 0.3s ease-in-out;
}

.vendor-header {
    background-color: var(--white-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
}

/* --- NEW/IMPROVED Sidebar Styles --- */
.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid #343a40;
}
.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white-color);
}
.sidebar-logo .logo-red { color: #dc3545; }

.sidebar-nav {
    flex-grow: 1;
    padding-top: 1rem;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.5rem;
    color: var(--sidebar-text);
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}
.sidebar-nav a:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-active);
}
.sidebar-nav a.active {
    background-color: var(--primary-color);
    color: var(--sidebar-active);
}
.sidebar-nav a i {
    width: 35px;
    font-size: 1.1rem;
    text-align: center;
    margin-right: 0.5rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid #343a40;
}
.logout-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--sidebar-text);
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}
.logout-link:hover {
    background-color: var(--danger-color);
    color: var(--white-color);
}
.logout-link i {
    width: 35px;
    font-size: 1.1rem;
    text-align: center;
    margin-right: 0.5rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}
.header-user-info i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.content-area {
    padding: 2rem;
}
.page-title {
    font-size: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 992px) {
    .vendor-sidebar {
        transform: translateX(-250px);
    }
    .vendor-sidebar.is-open {
        transform: translateX(0);
    }
    .vendor-main-content {
        margin-left: 0;
        width: 100%;
    }
    .sidebar-toggle {
        display: block;
    }
}

/* --- Dashboard Components --- */
.vendor-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}
.stat-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.stat-card-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
    height: 60px;
    width: 60px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}
.stat-card-info h3 { font-size: 1rem; color: var(--secondary-color); margin-bottom: 0.25rem; font-weight: 500; }
.stat-card-info .value { font-size: 2.25rem; font-weight: 700; color: var(--dark-color); line-height: 1.2; }

/* --- Generic Card & Table Styles --- */
.content-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}
.card-header { margin-bottom: 1.5rem; }
.card-title { font-size: 1.5rem; margin: 0; }
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.data-table th, .data-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.data-table th { font-weight: 600; background-color: var(--light-color); }
.data-table tbody tr:hover { background-color: #f1f1f1; }
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.action-buttons a, .action-buttons button {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--white-color);
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
}
.view-btn { background-color: var(--primary-color); }
.edit-btn { background-color: var(--warning-color); color: var(--dark-color); }
.delete-btn { background-color: var(--danger-color); }

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn-primary { background-color: var(--primary-color); color: var(--white-color); }
.btn-secondary { background-color: var(--secondary-color); color: var(--white-color); }
.btn:hover { opacity: 0.85; }

/* Form grid for settings page */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* --- Flash Messages --- */
.flash-message {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    color: var(--white-color);
}
.flash-message.success { background-color: var(--success-color); }
.flash-message.error { background-color: var(--danger-color); }
.flash-message.warning { background-color: var(--warning-color); color: var(--dark-color); }


@media (max-width: 768px) {
    .content-area { padding: 1rem; }
    .page-title { font-size: 1.75rem; }
    .content-card { padding: 1.5rem; }

    /* Responsive Tables */
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
    }
    .data-table td {
        text-align: right;
        position: relative;
        padding-left: 50%;
        border-bottom: 1px solid #f0f0f0;
    }
    .data-table td:last-child { border-bottom: 0; }
    .data-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: calc(50% - 2rem);
        text-align: left;
        font-weight: 600;
        color: var(--dark-color);
    }
    .action-buttons { justify-content: flex-end; }
}

@media (max-width: 480px) {
    .vendor-auth-container { padding: 1.5rem; }
    .stat-card { flex-direction: column; text-align: center; gap: 0.5rem; }
}

/* Enhanced Auth Form Styles */
.vendor-auth-container .form-header {
    text-align: center;
    margin-bottom: 2rem;
}
.vendor-auth-container .form-header h2 {
    margin-bottom: 0.5rem;
}
.vendor-auth-container .form-header p {
    color: var(--secondary-color);
    font-size: 1rem;
}

/* Password Input with Toggle */
.password-wrapper {
    position: relative;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--secondary-color);
}

/* Terms and Conditions Checkbox */
.form-group-terms {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}
.form-group-terms input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary-color);
}
.form-group-terms label {
    margin: 0;
    font-weight: normal;
}
.form-group-terms a {
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
}

/* Modal for Terms and Conditions */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1050;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}
.modal-overlay.is-visible {
    display: flex;
}
.modal-content {
    background: var(--white-color);
    padding: 2.5rem;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.modal-title {
    font-size: 1.75rem;
    margin: 0;
}
.close-modal-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    color: var(--secondary-color);
}
.modal-body p {
    margin-bottom: 1rem;
}
.modal-body h4 {
    margin-top: 1.5rem;
}

/* Sidebar Overlay (Scrim) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999; /* Below the sidebar (z-index: 1000) but above everything else */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0s 0.3s linear;
}

.sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in-out;
}

/* Utility class to prevent background scrolling */
body.no-scroll {
    overflow: hidden;
}