/* ==========================================
   AKGROUPS ADMIN - ADVANCED RESPONSIVE DESIGN
   Mobile-First Approach with Modern Features
   ========================================== */

:root {
    --primary: #FF6B35;
    --secondary: #004E89;
    --dark: #0A0E27;
    --light: #F7F7FF;
    --white: #FFFFFF;
    --gray: #8E9AAF;
    --success: #06FFA5;
    --warning: #FFB627;
    --error: #FF4757;
    --gradient-1: linear-gradient(135deg, #FF6B35 0%, #FFB627 100%);
    --gradient-2: linear-gradient(135deg, #004E89 0%, #1A659E 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   MOBILE BREAKPOINTS
   ========================================== */
/* Mobile First: <640px */
/* Tablet: 641px - 1024px */
/* Desktop: >1025px */

/* ==========================================
   GENERAL RESPONSIVE FIXES
   ========================================== */

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* Container Responsive Padding */
.container {
    padding: 1rem !important;
}

@media (min-width: 641px) {
    .container {
        padding: 2rem !important;
    }
}

@media (min-width: 1025px) {
    .container {
        padding: 3rem !important;
    }
}

/* ==========================================
   HEADER & NAVIGATION RESPONSIVE
   ========================================== */

header {
    padding: 1rem 1rem !important;
}

@media (min-width: 641px) {
    header {
        padding: 1.5rem 2rem !important;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-btn {
    display: none;
    background: var(--gradient-1);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-menu-btn:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-md);
    }
}

/* Sidebar Toggle for Mobile */
.sidebar {
    transition: transform 0.3s ease;
}

@media (max-width: 640px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        width: 75%;
        height: 100vh;
        z-index: 999;
        background: var(--white);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar::after {
        content: '';
        position: absolute;
        top: 0;
        right: -100vw;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        cursor: pointer;
    }
}

/* ==========================================
   FORMS RESPONSIVE
   ========================================== */

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 641px) {
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .form-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

input,
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    input,
    textarea,
    select {
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* ==========================================
   BUTTONS RESPONSIVE
   ========================================== */

.btn,
button {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .btn,
    button {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        width: 100%;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (min-width: 641px) {
    .btn-group {
        display: flex;
        flex-direction: row;
        gap: 1rem;
    }
}

/* ==========================================
   TABLES RESPONSIVE
   ========================================== */

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
    table {
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 0.75rem 0.5rem !important;
    }

    /* Hide unnecessary columns on mobile */
    table th:nth-child(n+4),
    table td:nth-child(n+4) {
        display: none;
    }
}

@media (min-width: 641px) {
    table th,
    table td {
        padding: 1rem;
    }
}

/* Card-Style Table View on Mobile */
.table-mobile {
    display: none;
}

@media (max-width: 640px) {
    .table-mobile {
        display: block;
    }

    .table-desktop {
        display: none;
    }

    .mobile-card {
        background: var(--white);
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: var(--shadow-sm);
        border-left: 4px solid var(--primary);
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid #eee;
    }

    .mobile-card-row:last-child {
        border-bottom: none;
    }

    .mobile-card-label {
        font-weight: 600;
        color: var(--gray);
        min-width: 120px;
    }

    .mobile-card-value {
        color: var(--dark);
        word-break: break-word;
    }
}

/* ==========================================
   GRID LAYOUTS RESPONSIVE
   ========================================== */

.grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 641px) {
    .grid-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .grid-3 {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    .grid-4 {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* ==========================================
   CARDS RESPONSIVE
   ========================================== */

.card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    .card {
        padding: 1rem;
        border-radius: 10px;
    }
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

/* ==========================================
   MODALS RESPONSIVE
   ========================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    max-width: 90vw;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

@media (min-width: 641px) {
    .modal-content {
        max-width: 600px;
        padding: 2rem;
    }
}

@media (min-width: 1025px) {
    .modal-content {
        max-width: 800px;
    }
}

/* ==========================================
   ALERTS & NOTIFICATIONS RESPONSIVE
   ========================================== */

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

@media (max-width: 640px) {
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.alert-message {
    flex-grow: 1;
    word-break: break-word;
}

/* ==========================================
   TEXT RESPONSIVE
   ========================================== */

h1 {
    font-size: 1.75rem;
}

@media (min-width: 641px) {
    h1 {
        font-size: 2.25rem;
    }
}

@media (min-width: 1025px) {
    h1 {
        font-size: 2.75rem;
    }
}

h2 {
    font-size: 1.5rem;
}

@media (min-width: 641px) {
    h2 {
        font-size: 1.75rem;
    }
}

@media (min-width: 1025px) {
    h2 {
        font-size: 2rem;
    }
}

h3 {
    font-size: 1.25rem;
}

@media (min-width: 641px) {
    h3 {
        font-size: 1.5rem;
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

.hidden-mobile {
    display: none;
}

@media (min-width: 641px) {
    .hidden-mobile {
        display: block;
    }
}

.hidden-tablet {
    display: none;
}

@media (min-width: 1025px) {
    .hidden-tablet {
        display: block;
    }
}

.hidden-desktop {
    display: none;
}

@media (max-width: 1024px) {
    .hidden-desktop {
        display: block;
    }
}

/* Flex Responsive */
.flex-responsive {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 641px) {
    .flex-responsive {
        flex-direction: row;
        gap: 1.5rem;
    }
}

/* Padding Responsive */
.p-responsive {
    padding: 1rem;
}

@media (min-width: 641px) {
    .p-responsive {
        padding: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .p-responsive {
        padding: 2rem;
    }
}

/* ==========================================
   DASHBOARD SPECIFIC
   ========================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 641px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1025px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* Stat Card */
.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    .stat-card {
        padding: 1rem;
    }
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0.5rem 0;
}

@media (min-width: 641px) {
    .stat-number {
        font-size: 2.25rem;
    }
}

.stat-label {
    color: var(--gray);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ==========================================
   LIST RESPONSIVE
   ========================================== */

.list-item {
    background: var(--white);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 641px) {
    .list-item {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
}

/* ==========================================
   UPLOAD AREA RESPONSIVE
   ========================================== */

.upload-area {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 107, 53, 0.05);
}

@media (min-width: 641px) {
    .upload-area {
        padding: 3rem 2rem;
    }
}

.upload-area:hover {
    background: rgba(255, 107, 53, 0.1);
    border-color: var(--secondary);
}

/* ==========================================
   FOOTER RESPONSIVE
   ========================================== */

footer {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.9rem;
}

@media (min-width: 641px) {
    footer {
        padding: 2rem;
    }
}

/* ==========================================
   PRINTING
   ========================================== */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .modal {
        display: none;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Focus Visible for Keyboard Navigation */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==========================================
   LANDSCAPE MOBILE
   ========================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .container {
        padding: 0.5rem;
    }

    h1 {
        font-size: 1.25rem;
    }

    .card {
        padding: 0.75rem;
    }
}
