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

body {
    background-color: #f8fafc;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sidebar Styles */
.sidebar {
    background: #1e3a8a;
    height: 100vh;
    position: fixed;
    width: 260px;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    left: -260px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
    left: 0;
}

/* Main Content */
.main-content {
    margin-left: 0;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    padding-top: 80px;
}

/* Responsive Styles */
@media (min-width: 769px) {
    .sidebar {
        left: 0;
    }
    .main-content {
        margin-left: 260px;
        padding: 40px;
    }
    .mobile-header {
        display: none !important;
    }
}

/* Mobile Header */
.mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 1000;
    padding: 15px 20px;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Card Styles */
.card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    display: block;
}

/* Hide Scrollbar */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Edit Modal */
.edit-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}

.edit-modal.active {
    display: flex;
}

/* Camera Containers */
#camera-container {
    display: none;
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 10px auto;
    border-radius: 1rem;
    overflow: hidden;
    background: #000;
}

#camera-video {
    width: 100%;
    height: auto;
}

#camera-canvas {
    display: none;
}

#edit-camera-container {
    display: none;
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 10px auto;
    border-radius: 1rem;
    overflow: hidden;
    background: #000;
}

#edit-camera-video {
    width: 100%;
    height: auto;
}

/* Loading Spinner Styles */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e2e8f0;
    border-top: 5px solid #1e3a8a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Input Focus States */
input:focus, select:focus, textarea:focus {
    border-color: #1e3a8a;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Button Hover Effects */
button {
    cursor: pointer;
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #1e3a8a;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a2f7a;
}

/* PWA Specific Styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
    }
    
    .mobile-header {
        padding-top: calc(15px + env(safe-area-inset-top));
    }
}

/* Touch Optimization */
@media (hover: none) {
    button {
        -webkit-tap-highlight-color: transparent;
    }
    
    button:active {
        opacity: 0.7;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .mobile-header {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 20px !important;
    }
}