/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: block;
    white-space: nowrap;
}

.nav-links a:hover {
    background-color: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

/* Sub Navigation Bar */
.sub-navbar {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 1rem 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.branch-section {
    margin-bottom: 1.5rem;
    text-align: left;
}

.branch-section:last-child {
    margin-bottom: 0;
}

.branch-title {
    color: #000000;
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* User sub-navigation links - vertical layout */
.sub-navbar .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: inline-block;
    padding: 0.5rem 0;
    color: #000000;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    border-bottom: 1px solid transparent;
}

.nav-link:hover {
    color: #007bff;
    border-bottom-color: #007bff;
}

.nav-link.active {
    color: #007bff;
    font-weight: 600;
    border-bottom-color: #007bff;
}

/* User Category Tabs - Enhanced Styling */
.user-category-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.user-category-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #666;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: block;
    border-bottom: none;
}

.user-category-tab:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-decoration: none;
    border-bottom: none;
}

.user-category-tab.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    border-bottom: none;
}

/* Responsive Sub Navigation */
@media (max-width: 768px) {
    .sub-navbar {
        padding: 0.75rem 0;
    }
    
    .user-category-tabs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .user-category-tab {
        margin-bottom: 0.5rem;
    }
    
    .branch-section {
        margin-bottom: 1rem;
        padding: 0 1rem;
    }
    
    .branch-title {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }
}

/* Cards and Layout */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
}

.header-bar h1 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.date-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.date-label {
    background: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-primary {
    background: #3498db;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid #3498db;
    color: #3498db;
}

.btn-outline:hover {
    background: #3498db;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background: #34495e;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

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

/* Stock Table Specific Styles */
.stock-table th,
.admin-stock-table th {
    position: sticky;
    top: 0;
    z-index: 10;
}

.item-name {
    font-weight: 700;
    color: #2c3e50;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.input-cell {
    padding: 0.5rem;
    background-color: #f8f9ff;
    border: 1px solid #e3f2fd;
}

.given-out {
    text-align: center;
    font-weight: bold;
    color: #e74c3c;
    background-color: #fdf2f2;
    padding: 0.5rem;
}

.readonly-cell {
    padding: 0.5rem;
    background-color: #f8f9fa;
    color: #6c757d;
    font-weight: 500;
    text-align: center;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.form-input {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #ecf0f1;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    background-color: #ffffff;
    min-height: 40px;
}

.form-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.calculated-cell {
    background-color: #e8f5e8;
    font-weight: 600;
    color: #27ae60;
}

.check-cell {
    text-align: center;
}

.check-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.check-equal {
    background: #d5f4e6;
    color: #27ae60;
}

.check-excess {
    background: #fadbd8;
    color: #e74c3c;
}

.check-less {
    background: #fef9e7;
    color: #f39c12;
}

.price-cell {
    text-align: right;
    font-weight: 500;
}

.no-price {
    color: #95a5a6;
    font-style: italic;
}

.unit-total {
    text-align: right;
    font-weight: 600;
    color: #27ae60;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

/* No Data State */
.no-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 2rem;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: white;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Mobile Menu Animation */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .header-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    /* Mobile Navigation */
    .navbar .container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 80px 0 20px 0;
        transition: left 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links li {
        margin: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .nav-links a {
        display: block;
        padding: 1rem 2rem;
        text-align: left;
        font-size: 1rem;
        border-radius: 0;
        transition: all 0.3s ease;
    }
    
    .nav-links a:hover {
        background-color: rgba(255,255,255,0.1);
        transform: none;
        padding-left: 2.5rem;
    }
    
    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .mobile-menu-toggle {
        width: 28px;
        height: 28px;
    }
    
    .hamburger-line {
        width: 22px;
        height: 2px;
    }
    
    .nav-links {
        width: 85%;
        max-width: 280px;
    }
    
    .nav-links a {
        padding: 1.2rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .nav-links a:hover {
        padding-left: 2rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error Messages */
.messages {
    margin-bottom: 1rem;
}

.message {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.message.success {
    background: #d5f4e6;
    color: #27ae60;
    border: 1px solid #27ae60;
}

.message.error {
    background: #fadbd8;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.message.info {
    background: #d6eaf8;
    color: #3498db;
    border: 1px solid #3498db;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* Print Styles */
@media print {
    .navbar,
    .form-actions,
    .btn {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    table {
        box-shadow: none;
    }
}

/* Activity tracking */
.last-updated {
    min-width: 120px;
    font-size: 0.8rem;
}

.update-info {
    line-height: 1.2;
}

.update-info small {
    color: #666;
    font-size: 0.7rem;
}

/* Branch badges */
.branch-badge {
    display: inline-block;
    background: #e8f4fd;
    color: #2980b9;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin: 0.1rem;
    font-weight: 500;
}

.no-branch {
    color: #95a5a6;
    font-style: italic;
}

/* User Sales Stock Navigation */
.user-sales-stock-nav {
    text-align: center;
    padding: 1rem 0;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-radius: 8px;
    margin: 0.5rem 0;
}

.user-sales-stock-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
}

.user-sales-stock-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
}

.user-sales-stock-link.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-description {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Text utility classes */
.text-muted {
    color: #6c757d !important;
    font-size: 0.85rem;
    font-style: italic;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #17a2b8 !important;
}

/* Auto-calculated field styling */
.auto-calculated {
    background-color: #e8f5e8;
    border: 1px solid #c3e6c3;
    color: #155724;
    font-weight: 500;
}

.auto-calculated small {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Form check input styling */
.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    vertical-align: top;
    background-color: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid rgba(0, 0, 0, 0.25);
    appearance: none;
    color-adjust: exact;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease-in-out, background-position 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
