/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Global Color Variables - Pastel Brown & Cream Theme */
:root {
    --primary-brown: #A67C52;
    --primary-brown-dark: #8B6F47;
    --primary-brown-darker: #6B4423;
    --secondary-cream: #FFF8E7;
    --secondary-cream-dark: #F5EBE0;
    --accent-brown-light: #C9A882;
    --border-color: #D7C4B0;
    --text-primary: #6B4423;
    --text-secondary: #8B6F47;
    --text-muted: #B5927B;
    --bg-light: #FDFAF5;
    --shadow-color: rgba(166, 124, 82, 0.15);
}

body {
    background-color: var(--bg-light);
    color: var(--text-primary);
}

/* Login styles */
#login-container {
    display: none;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#login-container.active {
    display: flex;
}

/* Login layout: Image left (2/3), Form right (1/3) */
#login-container::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 66.66%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1442512595331-e89e73853f31?q=80&w=2070') center/cover no-repeat;
    z-index: 1;
}

/* Dark overlay on image with warm tone */
#login-container::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 66.66%;
    height: 100%;
    background: linear-gradient(to right, rgba(101, 67, 33, 0.4), rgba(121, 85, 72, 0.2));
    z-index: 2;
}

.system-title {
    position: absolute;
    left: 4%;
    top: 5%;
    transform: none;
    color: #FFF8E7;
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    font-weight: 700;
    text-align: left;
    text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.6);
    padding: 0;
    z-index: 3;
    line-height: 1.3;
    white-space: nowrap;
    letter-spacing: 2px;
    max-width: 60%;
}

.login-form {
    position: absolute;
    right: 0;
    top: 0;
    width: 33.34%;
    height: 100%;
    background: linear-gradient(135deg, #FFF8E7 0%, #F5EBE0 50%, #FAEBD7 100%);
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 10;
    box-shadow: -5px 0 20px rgba(101, 67, 33, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h2 {
    font-size: 1.8rem;
    color: #6B4423;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #8B6F47;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #6B4423;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #D7C4B0;
    border-radius: 10px;
    outline: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: #FFFFFF;
}

.form-group input:focus {
    border-color: #A67C52;
    box-shadow: 0 0 0 4px rgba(166, 124, 82, 0.1);
}

.form-group input::placeholder {
    color: #B5927B;
}

/* Login form styles */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-actions button {
    width: 100%;
    padding: 0.9rem 1rem;
    background: linear-gradient(135deg, #A67C52, #8B6F47);
    color: #FFF8E7;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(166, 124, 82, 0.2);
}

.form-actions button:hover {
    background: linear-gradient(135deg, #8B6F47, #6B4423);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(166, 124, 82, 0.3);
}

/* Make form action buttons inline for the stock-check edit modal */
#editMaterialModal .form-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}
#editMaterialModal .form-actions .save-btn,
#editMaterialModal .form-actions .cancel-btn {
    min-width: 140px;
}

/* Make Add Material modal action buttons inline */
#addMaterialModal .form-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}
#addMaterialModal .form-actions .save-btn,
#addMaterialModal .form-actions .cancel-btn {
    min-width: 140px;
}

/* Make Edit Import Entry modal action buttons inline (used in 'Chỉnh sửa nguyên liệu') */
#editImportEntryModal .form-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}
#editImportEntryModal .form-actions .save-btn,
#editImportEntryModal .form-actions .cancel-btn {
    min-width: 140px;
}
.forgot-password {
    color: #A67C52;
    text-decoration: none;
    font-size: 0.9rem;
    text-align: center;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #8B6F47;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    #login-container::before,
    #login-container::after {
        width: 60%;
    }
    
    .login-form {
        width: 40%;
    }
    
    .system-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    #login-container::before,
    #login-container::after {
        width: 0;
    }
    
    .system-title {
        display: none;
    }
    
    .login-form {
        width: 100%;
        padding: 2rem 1.5rem;
    }
}

/* Toast Notification */
.toast-notification {
    visibility: hidden;
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background-color: #4CAF50;
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transform: translateX(100%);
}

.toast-notification.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
    transition: all 0.5s ease-in-out;
}

.toast-icon {
    margin-right: 12px;
}

.toast-icon i {
    font-size: 24px;
    color: white;
}

.toast-text {
    font-size: 16px;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

button {
    width: 100%;
    padding: 0.8rem;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

button:hover {
    background: #1565c0;
}

/* Action icon buttons used across tables/lists (edit/delete) */
.action-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 36px;
    border-radius: 10px;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.action-icon-btn.edit {
    background: #10b981; /* green */
    box-shadow: 0 4px 10px rgba(16,185,129,0.15);
}
.action-icon-btn.edit:hover {
    background: #059669;
    transform: translateY(-2px);
}

.action-icon-btn.delete {
    background: #dc3545; /* red */
    box-shadow: 0 4px 10px rgba(220,53,69,0.12);
}
.action-icon-btn.delete:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Main container styles */
#main-container {
    min-height: 100vh;
    background: #f5f5f5;
}

#main-container.hidden {
    display: none;
}

/* Navbar styles */
.navbar {
    background: linear-gradient(135deg, var(--secondary-cream) 0%, var(--secondary-cream-dark) 100%);
    padding: 1.5rem 2.5rem;
    box-shadow: 0 2px 8px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--border-color);
}

/* Toast Styles */


.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0;
    width: 100%;
    justify-content: space-between;
}

.nav-menu > li {
    flex: 1;
    display: flex;
    justify-content: center;
}

.navbar a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    padding: 1rem 1.8rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    justify-content: center;
}

.navbar a:hover,
.navbar a.active {
    background: linear-gradient(135deg, var(--primary-brown), var(--primary-brown-dark));
    color: var(--secondary-cream);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.navbar i {
    font-size: 1.2rem;
}

/* Hover effect enhancement */
.navbar a::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--primary-brown);
    transition: width 0.3s ease;
    position: absolute;
    bottom: -2px;
    left: 0;
}

/* Content styles */
.content {
    padding: 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Dashboard styles */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.dashboard-item {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 0 15px var(--shadow-color);
    text-align: center;
    border: 1px solid var(--border-color);
}

.dashboard-item i {
    font-size: 2.5rem;
    color: var(--primary-brown);
    margin-bottom: 1rem;
}

.dashboard-item h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.dashboard-item p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: bold;
}

/* Profile styles */
.profile-container {
    position: relative;
}

.profile-circle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    margin-left: 2rem;
}

.profile-circle:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 8px var(--shadow-color);
}

.profile-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-brown);
    box-shadow: 0 2px 6px var(--shadow-color);
}

.store-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.store-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.access-level {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: var(--secondary-cream);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-top: 0.5rem;
    display: none;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.profile-dropdown.active {
    display: block;
}

.dropdown-header {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.dropdown-header .store-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-header .access-level {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background-color: #eee;
    margin: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item i {
    width: 20px;
    min-width: 20px;
    color: var(--primary-brown);
    display: flex;
    align-items: flex-start;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

/* Role Selection Buttons */
.role-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(166, 124, 82, 0.4);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 10px;
    width: 90%;
    max-width: 520px;
    position: relative;
    margin: auto;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #1976d2;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 1rem;
}

/* Verification Methods Styling */
.verification-methods {
    margin-bottom: 2rem;
}

.verification-methods h4 {
    color: #333;
    margin-bottom: 1rem;
}

.method-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.method-btn {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.method-btn i {
    font-size: 1.5rem;
    color: #1976d2;
}

.method-btn.active {
    background: #e3f2fd;
    border-color: #1976d2;
    color: #1976d2;
}

.verification-form {
    display: none;
}

.verification-form.active {
    display: block;
}

/* Verification Code Input Styling */
.verification-code-input {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0;
}

.code-digit {
    width: 45px;
    height: 45px;
    text-align: center;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.code-digit:focus {
    border-color: #1976d2;
    background: white;
}

.resend-code {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

#resendCode {
    background: none;
    border: none;
    color: #1976d2;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

#resendCode:disabled {
    color: #999;
    cursor: not-allowed;
}

#codeTimer {
    color: #666;
}

.logo-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
}

#logoPreview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}

.upload-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upload-btn {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-btn:hover {
    background-color: #1565c0;
}

.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding: 0 1rem;
}

.save-btn,
.cancel-btn {
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 13px;
    flex: 0 1 auto;
    max-width: 150px;
}

.save-btn {
    background: #28a745 !important;
    color: white !important;
    border: 2px solid #28a745 !important;
    box-shadow: none;
}

.save-btn i {
    color: white !important;
}

.save-btn:hover {
    background: #218838 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    border-color: #218838 !important;
}

.cancel-btn {
    background-color: #dc3545 !important;
    color: white !important;
    border: 2px solid #dc3545 !important;
}

.cancel-btn i {
    color: white !important;
}

.cancel-btn:hover {
    background-color: #c82333 !important;
    border-color: #c82333 !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar a {
        display: block;
        text-align: center;
    }

    .profile-circle .store-info {
        display: none;
    }

    .dashboard {
        grid-template-columns: 1fr;
    }
}

/* Attendance form buttons */
.save-button,
.clear-button {
    padding: 12px 28px;
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.save-button {
    background-color: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

.save-button i {
    color: white !important;
}

.save-button:hover {
    background-color: #218838 !important;
    border-color: #218838 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.clear-button {
    background-color: #dc3545 !important;
    color: white !important;
    border-color: #dc3545 !important;
}

.clear-button i {
    color: white !important;
}

.clear-button:hover {
    background-color: #c82333 !important;
    border-color: #c82333 !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}