/**
 * Valisha AI - Main Stylesheet
 * Mobile-First Responsive Design
 */

/* ============================================
   BASE STYLES
   ============================================ */

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background-color: #f8f9fa;
    color: #212529;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: 600;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    font-family: var(--font-family);
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #000;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
    color: #000;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1.1rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-control,
.form-select {
    font-family: var(--font-family);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(167, 24, 28, 0.15);
}

.form-control-lg {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
}

/* Password toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #6c757d;
    z-index: 10;
}

.password-toggle:hover {
    color: var(--primary-color);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 1.25rem;
}

/* ============================================
   NAVIGATION
   ============================================ */

/* Mobile Header */
.mobile-header {
    z-index: 1030;
}

/* Mobile Bottom Navigation */
.mobile-nav {
    z-index: 1030;
    padding: 0.5rem 0;
    background: #fff;
}

.mobile-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.mobile-nav .nav-link i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.mobile-nav .nav-link.active {
    color: var(--primary-color);
}

.mobile-nav .nav-link:hover {
    color: var(--primary-color);
}

/* Desktop Navbar */
.navbar {
    z-index: 1030;
}

.navbar-brand img {
    height: 40px;
}

/* ============================================
   LAYOUT
   ============================================ */

.main-content {
    flex: 1;
}

.pt-header {
    padding-top: 60px;
}

.pb-mobile-nav {
    padding-bottom: 70px;
}

@media (min-width: 768px) {
    .pt-header {
        padding-top: 70px;
    }
    
    .pb-mobile-nav {
        padding-bottom: 0;
    }
}

/* ============================================
   UPLOAD ZONE
   ============================================ */

.upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(167, 24, 28, 0.05);
}

.upload-zone i {
    font-size: 3rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.upload-zone.has-file {
    border-color: var(--primary-color);
    border-style: solid;
}

.upload-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    margin-top: 1rem;
}

/* ============================================
   MODEL GRID
   ============================================ */

.model-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .model-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .model-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.model-card {
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    aspect-ratio: 3/4;
}

.model-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.model-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-card.selected {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.model-card .check-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.model-card.selected .check-badge {
    display: flex;
}

/* ============================================
   CATEGORY SELECTOR
   ============================================ */

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: #fff;
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.category-card:hover {
    box-shadow: var(--shadow-md);
}

.category-card.selected {
    border-color: var(--primary-color);
    background: rgba(167, 24, 28, 0.05);
}

.category-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
}

.category-card span {
    font-weight: 500;
    color: #212529;
}

/* ============================================
   RESULTS
   ============================================ */

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.result-card {
    position: relative;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.result-card:hover {
    transform: scale(1.02);
}

.result-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
}

.result-card.selected {
    outline: 3px solid var(--primary-color);
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ============================================
   OTP INPUT
   ============================================ */

.otp-inputs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius);
    transition: border-color 0.2s;
}

.otp-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(167, 24, 28, 0.15);
}

/* ============================================
   CREDIT PACKAGES
   ============================================ */

.credit-package {
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.credit-package:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
}

.credit-package.selected {
    border-color: var(--primary-color);
    background: rgba(167, 24, 28, 0.05);
}

.credit-package .credits {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.credit-package .price {
    font-size: 1.25rem;
    color: #212529;
}

.credit-package.popular {
    position: relative;
    border-color: var(--secondary-color);
}

.credit-package.popular::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: #000;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================
   TRANSACTION HISTORY
   ============================================ */

.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.transaction-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.transaction-icon.credit {
    background: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.transaction-icon.debit {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.transaction-details {
    flex: 1;
}

.transaction-amount {
    font-weight: 600;
}

.transaction-amount.credit {
    color: #198754;
}

.transaction-amount.debit {
    color: #dc3545;
}

/* ============================================
   ADMIN SIDEBAR
   ============================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--admin-sidebar-bg);
    color: var(--admin-sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s;
}

.admin-sidebar .brand {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.admin-sidebar .nav-link i {
    width: 24px;
    margin-right: 0.75rem;
}

.admin-sidebar .nav-link:hover {
    background: var(--admin-sidebar-hover);
    color: #fff;
}

.admin-sidebar .nav-link.active {
    background: var(--admin-sidebar-active);
    color: #fff;
}

.admin-content {
    flex: 1;
    margin-left: 260px;
    padding: 1.5rem;
    background: #f8f9fa;
}

@media (max-width: 991px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.show {
        transform: translateX(0);
    }
    
    .admin-content {
        margin-left: 0;
    }
}

/* ============================================
   TABLES
   ============================================ */

.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
}

/* ============================================
   UTILITIES
   ============================================ */

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.rounded-lg {
    border-radius: var(--border-radius-lg) !important;
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-nav {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
    
    .pb-mobile-nav {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* ============================================
   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);
    }
}

/* ============================================
   TOAST CUSTOMIZATION
   ============================================ */

.toast {
    border-radius: var(--border-radius);
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 4rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.empty-state h5 {
    color: #6c757d;
}
