/* Modern Sidebar Layout Styles */

/* Desktop Sidebar */
.desktop-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: linear-gradient(180deg, #15803d 0%, #166534 100%);
    display: flex;
    flex-direction: column;
    z-index: 40;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9375rem;
    text-align: left;
}

.sidebar-nav-item i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.125rem;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.sidebar-nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-left-color: #4ade80;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.sidebar-user p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Top Header */
.top-header {
    position: fixed;
    top: 0;
    right: 0;
    height: 64px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    z-index: 30;
    width: 100%;
}

@media (min-width: 1024px) {
    .top-header {
        left: 260px;
        width: calc(100% - 260px);
    }
}

/* Main Content Area */
.main-content {
    padding: 1.5rem;
    min-height: 100vh;
    padding-top: calc(64px + 1.5rem);
}

@media (min-width: 1024px) {
    .main-content {
        margin-left: 260px;
    }
}

/* Mobile Navigation */
.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -300px;
    bottom: 0;
    width: 280px;
    background: linear-gradient(180deg, #15803d 0%, #166534 100%);
    z-index: 50;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-item {
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

.mobile-nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.mobile-nav-item i {
    width: 24px;
    font-size: 1.125rem;
}

.mobile-menu-btn {
    padding: 0.5rem;
    color: #374151;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.mobile-menu-btn:hover {
    background: #f3f4f6;
}

/* Section visibility */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 1023px) {
    .desktop-sidebar {
        display: none !important;
    }
    
    .top-header {
        left: 0 !important;
        width: 100% !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Print styles */
@media print {
    .desktop-sidebar,
    .mobile-nav,
    .mobile-nav-overlay,
    .top-header,
    .mobile-menu-btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Section Headers */
.section h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.section h2 i {
    margin-right: 0.75rem;
    color: #16a34a;
}

/* Card improvements */
.bg-white {
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Input fields */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Table styles */
.table-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary:hover {
    box-shadow: 0 4px 6px rgba(22, 163, 74, 0.3);
    transform: translateY(-1px);
}

/* Action buttons */
.action-btn {
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
}

.action-btn:hover {
    background: #f3f4f6;
}

/* Modal improvements */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Touch-friendly mobile buttons */
@media (max-width: 768px) {
    .action-btn,
    .mobile-menu-btn,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Herbs & Roots export buttons - stack vertically on mobile */
    #prescriptions-section .flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #prescriptions-section .flex.gap-2 input {
        width: 100%;
    }
    
    #prescriptions-section .flex.gap-2 button {
        width: 100%;
        justify-content: center;
    }
    
    /* Action buttons in tables - horizontal layout */
    table tbody td button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.5rem;
    }
    
    table tbody td button:last-child {
        margin-right: 0;
    }
    
    /* Ensure action column has enough space */
    table tbody td:last-child {
        white-space: nowrap;
    }
}

/* Smooth transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

button, a {
    -webkit-user-select: none;
    user-select: none;
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section.active {
    animation: fadeIn 0.3s ease-out;
}

/* Hover effects for cards */
.stat-card,
.bg-white {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Table row hover */
tbody tr {
    transition: background-color 0.2s ease;
}

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

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #16a34a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #15803d;
}
