/* styles.css - Metapolska ERP Styling */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    overflow-x: hidden;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.form-container {
    background: white;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Tab Navigation */
.tab-active {
    background: white;
    color: #2563eb;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    background: #1f2937;
    z-index: 40;
    transition: transform 0.3s ease;
}

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

.sidebar-overlay.active {
    display: block;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    transition: margin-left 0.3s ease;
}

@media (max-width: 1023px) {
    .main-content {
        margin-left: 0;
    }
}

/* Menu Items */
.menu-item {
    position: relative;
    color: #d1d5db;
    text-decoration: none;
}

.menu-item:hover {
    color: white;
    background: #374151;
}

.menu-item.active {
    background: #374151;
    color: white;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: #3b82f6;
    border-radius: 0 4px 4px 0;
}

.menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    padding: 1rem;
    overflow-y: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    ring: 2px;
    ring-color: #3b82f6;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: #f9fafb;
}

table th {
    padding: 0.75rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table td {
    padding: 1rem 1.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
}

table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

table tbody tr:hover {
    background: #f9fafb;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

/* Progress Bar */
.progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Spinner */
.spinner {
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notification Dropdown */
#notification-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 20rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

/* Empty States */
.empty-state {
    padding: 3rem;
    text-align: center;
}

.empty-state-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    table th,
    table td {
        padding: 0.5rem;
    }
    
    #toast-container {
        left: 1rem;
        right: 1rem;
    }
    
    .toast {
        min-width: auto;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    header,
    .btn-primary,
    button {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body {
        background: white;
    }
}

/* Utility Classes */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hover-scale {
    transition: transform 0.2s;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.shadow-soft {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Status Indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-dot.pending {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.status-dot.inactive {
    background: #6b7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.2);
}

/* Custom Checkbox and Radio */
input[type="checkbox"],
input[type="radio"] {
    cursor: pointer;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* File Upload */
input[type="file"] {
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

input[type="file"]::file-selector-button:hover {
    background: #f3f4f6;
}

/* Transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* ============================================
   MOBILE HAMBURGER MENU - COMPLETE
   ============================================ */

/* Hide hamburger by default */
.mobile-menu-toggle {
    display: none;
}

/* Mobile styles */
@media (max-width: 1023px) {
    /* Show hamburger on mobile */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        background: #1f2937;
        border: none;
        border-radius: 8px;
        color: white;
        cursor: pointer;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1001;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }
    
    .mobile-menu-toggle:hover {
        background: #374151;
        transform: scale(1.05);
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
    
    /* Sidebar mobile positioning */
    #sidebar {
        position: fixed !important;
        left: -280px;
        top: 0;
        width: 280px !important;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    #sidebar.active {
        left: 0 !important;
    }
    
    /* Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* Main content adjustment */
    .main-content {
        margin-left: 0 !important;
        padding-top: 4rem;
    }
}

/* ============================================
   LOGOUT VISIBLE ON MOBILE - ADD TO styles.css
   Ensures logout stays ABOVE screen bottom
   ============================================ */

/* Sidebar full height flex layout */
.sidebar {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
}

/* User header - fixed */
.sidebar > div:first-child {
    flex-shrink: 0;
}

/* Nav - scrollable area with padding for logout */
.sidebar > nav {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 0 !important;
}

/* Sidebar menu - flex container */
#sidebar-menu {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100% !important;
    padding-bottom: 80px !important; /* Space for logout button */
}

/* Mobile specific fixes */
@media (max-width: 1023px) {
    .sidebar {
        height: 100vh !important;
        max-height: 100vh !important;
    }
    
    .sidebar > nav {
        flex: 1 !important;
        overflow-y: auto !important;
        /* Add safe area for mobile notches/home indicators */
        padding-bottom: env(safe-area-inset-bottom, 0) !important;
    }
    
    /* Ensure logout is above bottom */
    #sidebar-menu {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0)) !important;
    }
    
    /* Logout button visibility */
    .logout-btn {
        display: flex !important;
        min-height: 48px !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Push logout up from very bottom */
    [style*="position: sticky"][style*="bottom: 0"] {
        bottom: 0 !important;
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0)) !important;
    }
}

/* Ensure sticky positioning works */
.sticky,
[style*="position: sticky"] {
    position: sticky !important;
}