/* style.css - iOS Light Theme Design System for Webapp */

:root {
    --ios-bg: #F2F2F7;
    --ios-card-bg: #FFFFFF;
    --ios-text-primary: #1C1C1E;
    --ios-text-secondary: #3A3A3C;
    --ios-text-tertiary: #8E8E93;
    --ios-blue: #007AFF;
    --ios-blue-light: #E5F1FF;
    --ios-green: #34C759;
    --ios-green-light: #EAF9EE;
    --ios-orange: #FF9500;
    --ios-orange-light: #FFF5E6;
    --ios-red: #FF3B30;
    --ios-red-light: #FFEBEA;
    --ios-border: #E5E5EA;
    --ios-gray-light: #F2F2F7;
    --ios-gray-mid: #D1D1D6;
    --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.04);
    --border-radius-card: 14px;
    --border-radius-button: 10px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --bottom-bar-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-system);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--ios-bg);
    color: var(--ios-text-primary);
    font-size: 15px;
    line-height: 1.4;
    overflow-x: hidden;
}

a {
    color: var(--ios-blue);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* Auth Pages Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background-color: var(--ios-bg);
}

.auth-card {
    background: var(--ios-card-bg);
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--ios-border);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    border-radius: 16px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--ios-text-primary);
    letter-spacing: -0.5px;
}

.auth-header p {
    color: var(--ios-text-tertiary);
    font-size: 13px;
    margin-top: 4px;
}

/* App Main Layout Structure */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar navigation */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--ios-card-bg);
    border-right: 1px solid var(--ios-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--ios-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--ios-text-primary);
    gap: 10px;
}

.sidebar-brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.sidebar-menu {
    padding: 20px 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--border-radius-button);
    color: var(--ios-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.menu-item svg {
    width: 20px;
    height: 20px;
    stroke: var(--ios-text-secondary);
    fill: none;
    stroke-width: 2;
    transition: stroke 0.2s;
}

.menu-item:hover {
    background-color: var(--ios-gray-light);
    color: var(--ios-text-primary);
}

.menu-item:hover svg {
    stroke: var(--ios-text-primary);
}

.menu-item.active {
    background-color: var(--ios-blue-light);
    color: var(--ios-blue);
    font-weight: 600;
}

.menu-item.active svg {
    stroke: var(--ios-blue);
}

.menu-item.logout {
    color: var(--ios-red);
    margin-top: auto;
}

.menu-item.logout svg {
    stroke: var(--ios-red);
}

.menu-item.logout:hover {
    background-color: var(--ios-red-light);
}

/* Main Area */
.app-container {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    height: var(--header-height);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--ios-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ios-text-primary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--ios-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.app-content {
    padding: 24px;
    flex-grow: 1;
    margin-bottom: 20px;
}

.app-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--ios-border);
    text-align: center;
    color: var(--ios-text-tertiary);
    font-size: 12px;
    background-color: var(--ios-card-bg);
}

/* Dashboard Widgets & Cards */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--ios-card-bg);
    border-radius: var(--border-radius-card);
    padding: 16px;
    border: 1px solid var(--ios-border);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--ios-blue);
}

.stat-card.found::before { background-color: var(--ios-green); }
.stat-card.notfound::before { background-color: var(--ios-red); }
.stat-card.orange::before { background-color: var(--ios-orange); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--ios-text-tertiary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--ios-text-primary);
}

.stat-subtitle {
    font-size: 12px;
    color: var(--ios-text-secondary);
    margin-top: 4px;
}

/* Content Panel Layouts */
.panel {
    background-color: var(--ios-card-bg);
    border-radius: var(--border-radius-card);
    border: 1px solid var(--ios-border);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    margin-bottom: 24px;
}

.panel-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ios-text-primary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Forms styling (iOS Premium Inputs) */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--border-radius-button);
    border: 1px solid var(--ios-border);
    background-color: var(--ios-gray-light);
    color: var(--ios-text-primary);
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--ios-blue);
    background-color: var(--ios-card-bg);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.form-control::placeholder {
    color: var(--ios-text-tertiary);
}

/* Buttons (iOS Premium Design) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--border-radius-button);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.btn-primary {
    background-color: var(--ios-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #0062cc;
}

.btn-secondary {
    background-color: var(--ios-gray-light);
    color: var(--ios-text-primary);
    border: 1px solid var(--ios-border);
}

.btn-secondary:hover {
    background-color: var(--ios-border);
}

.btn-danger {
    background-color: var(--ios-red);
    color: white;
}

.btn-danger:hover {
    background-color: #d9231a;
}

.btn-success {
    background-color: var(--ios-green);
    color: white;
}

.btn-success:hover {
    background-color: #26a244;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
    width: auto;
}

/* Alerts and Badges */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-button);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: var(--ios-green-light);
    color: var(--ios-green);
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.alert-danger {
    background-color: var(--ios-red-light);
    color: var(--ios-red);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background-color: var(--ios-green-light); color: var(--ios-green); }
.badge-danger { background-color: var(--ios-red-light); color: var(--ios-red); }
.badge-warning { background-color: var(--ios-orange-light); color: var(--ios-orange); }
.badge-info { background-color: var(--ios-blue-light); color: var(--ios-blue); }

/* Details/List Rows styling */
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--ios-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--ios-text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.detail-value {
    font-weight: 600;
    color: var(--ios-text-primary);
    font-size: 14px;
}

.detail-value.capsule {
    background-color: var(--ios-gray-light);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--ios-border);
    font-size: 12px;
}

/* Accordion collapse style */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 14px;
    background-color: var(--ios-gray-light);
    border-radius: var(--border-radius-button);
}

.accordion-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.accordion-arrow {
    transition: transform 0.3s;
}

.accordion-content {
    display: none;
    padding: 16px 8px;
}

/* Tables styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.ios-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.ios-table th {
    background-color: var(--ios-gray-light);
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--ios-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ios-border);
}

.ios-table td {
    padding: 14px;
    border-bottom: 1px solid var(--ios-border);
    font-size: 13px;
    color: var(--ios-text-primary);
}

.ios-table tr:hover td {
    background-color: rgba(0, 0, 0, 0.01);
}

@media (max-width: 768px) {
    .ios-table, .ios-table thead, .ios-table tbody, .ios-table th, .ios-table td, .ios-table tr {
        display: block;
        width: 100%;
    }
    
    .ios-table thead {
        display: none; /* Hide header columns on mobile */
    }
    
    .ios-table tr {
        background: var(--ios-card-bg);
        border: 1px solid var(--ios-border);
        border-radius: var(--border-radius-button);
        padding: 12px 16px;
        margin-bottom: 12px;
        box-shadow: var(--shadow-soft);
    }
    
    .ios-table td {
        border-bottom: 1px solid var(--ios-border);
        padding: 10px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        font-size: 13.5px;
    }
    
    .ios-table td:last-child {
        border-bottom: none;
    }
    
    /* Inject text labels dynamically from data-label attributes */
    .ios-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ios-text-secondary);
        font-size: 12px;
        text-align: left;
        margin-right: 16px;
    }
}

/* Custom Switches (iOS Switches) */
.ios-switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--ios-border);
}

.ios-switch-container:last-child {
    border-bottom: none;
}

.switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ios-gray-mid);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

input:checked + .slider {
    background-color: var(--ios-green);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Payment Method Cards */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.payment-method-card {
    border: 1.5px solid var(--ios-border);
    border-radius: var(--border-radius-button);
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
    background-color: var(--ios-card-bg);
}

.payment-method-card:hover {
    border-color: var(--ios-blue);
    background-color: var(--ios-blue-light);
}

.payment-method-card.active {
    border-color: var(--ios-blue);
    background-color: var(--ios-blue-light);
    color: var(--ios-blue);
}

/* Chat/Ticket messages container */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    border-radius: var(--border-radius-button);
    background-color: var(--ios-gray-light);
    border: 1px solid var(--ios-border);
    margin-bottom: 16px;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    position: relative;
    line-height: 1.35;
}

.chat-bubble.admin {
    align-self: flex-start;
    background-color: var(--ios-card-bg);
    color: var(--ios-text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--ios-border);
}

.chat-bubble.user {
    align-self: flex-end;
    background-color: var(--ios-blue);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-meta {
    font-size: 10px;
    color: var(--ios-text-tertiary);
    margin-top: 4px;
    text-align: right;
}

.chat-bubble.user .chat-meta {
    color: rgba(255, 255, 255, 0.7);
}

/* Mobile responsive bottom bar & Slide menu */
.app-mobile-bar {
    display: none;
}

.app-mobile-nav {
    display: none;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding-bottom: calc(var(--bottom-bar-height) + 10px);
    }
    
    .app-sidebar {
        display: none; /* Hide desktop sidebar */
    }

    .app-container {
        margin-left: 0;
    }

    .app-header {
        padding: 0 16px;
    }

    .app-content {
        padding: 16px;
    }

    /* Bottom tab bar for iOS look and feel */
    .app-mobile-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--bottom-bar-height);
        background-color: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--ios-border);
        z-index: 100;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--ios-text-tertiary);
        font-size: 10px;
        font-weight: 500;
        flex-grow: 1;
        height: 100%;
        text-align: center;
        gap: 2px;
    }

    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
        stroke: var(--ios-text-tertiary);
        fill: none;
        stroke-width: 2;
    }

    .mobile-nav-item.active {
        color: var(--ios-blue);
        font-weight: 600;
    }

    .mobile-nav-item.active svg {
        stroke: var(--ios-blue);
    }

    .grid-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }
    
    .panel {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .grid-stats {
        grid-template-columns: 1fr;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 0;
    }
    
    .detail-value {
        align-self: flex-start;
        text-align: left;
    }
}

/* Custom Modal Overlay & Content (iOS Style Popup) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--ios-card-bg);
    width: 90%;
    max-width: 400px;
    border-radius: var(--border-radius-card);
    padding: 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--ios-border);
    animation: slideUp 0.25s cubic-bezier(0.1, 0.8, 0.25, 1);
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
