/**
 * 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;
    max-width: 200px;
    object-fit: contain;
    width: auto;
}

.mobile-logo {
    height: 32px;
    max-width: 150px;
    object-fit: contain;
    width: auto;
}

.admin-brand-logo {
    height: 35px;
    max-width: 180px;
    object-fit: contain;
    width: auto;
    margin-bottom: 0.5rem;
    display: block;
}

.login-logo {
    height: 60px;
    max-width: 250px;
    object-fit: contain;
    width: auto;
    margin: 0 auto;
    display: block;
}

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

/* ============================================
   INSTAGRAM-STYLE FEED
   ============================================ */

.feed-section {
    margin-bottom: 1rem;
}

.feed-card {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    border: 1px solid #dbdbdb;
    transition: none;
    max-width: 100%;
}

.feed-card:hover {
    box-shadow: none;
}

.feed-card .card-header,
.feed-card .card-footer {
    overflow: hidden;
}

.feed-card .card-header {
    border-bottom: 1px solid #efefef;
    padding: 10px 12px;
}

.feed-card .card-footer {
    border-top: 1px solid #efefef;
    padding: 10px 12px;
}

/* Feed Avatar */
.feed-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.feed-avatar img {
    width: 100%;
    height: 100%;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.feed-avatar i {
    font-size: 1.75rem;
    color: #666;
}

/* Feed Username & Time */
.feed-username {
    font-weight: 600;
    font-size: 0.875rem;
    color: #262626;
    line-height: 1.2;
}

.feed-time {
    font-size: 0.75rem;
    color: #8e8e8e;
    line-height: 1.2;
}

/* Feed Image */
.feed-image-container {
    position: relative;
    background: #fafafa;
    width: 100%;
    overflow: hidden;
}

/* Show full image (compressed) without cropping - natural aspect ratio */
.feed-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    vertical-align: top;
}

/* Feed Play Button Overlay */
.feed-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    padding: 0;
    font-size: 1.75rem;
}

.feed-play-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: #fff;
    transform: translate(-50%, -50%) scale(1.1);
}

.feed-play-btn:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.feed-play-btn i {
    margin-left: 4px; /* Slight offset for play icon visual centering */
}

/* Feed Actions */
.feed-actions {
    display: flex;
    align-items: center;
}

.feed-like-btn,
.feed-share-btn,
.feed-view-clothing-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 1.5rem;
    color: #262626;
    cursor: pointer;
    transition: transform 0.1s ease;
    text-decoration: none;
    line-height: 1;
}

.feed-like-btn:hover,
.feed-share-btn:hover,
.feed-view-clothing-btn:hover {
    color: #262626;
    text-decoration: none;
}

.feed-like-btn:active {
    transform: scale(0.9);
}

.feed-like-btn.liked i {
    color: #ed4956;
}

/* Like Animation */
.like-animation {
    animation: likeHeart 0.3s ease-in-out;
}

@keyframes likeHeart {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Feed Likes Count */
.feed-likes {
    font-size: 0.875rem;
    color: #262626;
}

.feed-likes .like-count {
    font-weight: 600;
    margin-right: 4px;
}

/* Double tap like animation overlay */
.feed-image-container .heart-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 5rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
}

.feed-image-container .heart-overlay.show {
    animation: heartBurst 0.8s ease-out forwards;
}

@keyframes heartBurst {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    30% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* Mobile optimizations */
@media (max-width: 576px) {
    .feed-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }
    
    .feed-card:first-child {
        border-top: none;
    }
}

/* Responsive feed container */
@media (min-width: 768px) {
    .feed-card {
        border-radius: var(--border-radius-lg);
    }
}

/* Ensure feed images don't overflow */
.feed-section .row {
    overflow: hidden;
}

.feed-section .col-12 {
    max-width: 100%;
    overflow: hidden;
}

/* Media Modals (Clothing & Video) */
.media-modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
}

.media-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1055;
    background-color: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    opacity: 0.9;
    transition: all 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3E%3Cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E") !important;
    background-size: 20px 20px;
    background-position: center;
    background-repeat: no-repeat;
}

.media-modal-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.5);
}

.media-modal-close::before {
    display: none;
}

#clothingModalImage,
#videoModalPlayer {
    display: block;
    margin: 0 auto;
    border-radius: 0;
}

#clothingModalImage {
    max-height: 90vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

#videoModalPlayer {
    max-height: 90vh;
    width: auto;
    max-width: 100%;
}

/* Load More Button */
#loadMoreContainer {
    padding: 1.5rem 0;
}

#loadMoreBtn {
    min-width: 150px;
}

#loadMoreBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#loadMoreSpinner {
    width: 2rem;
    height: 2rem;
}

/* ============================================
   WhatsApp Floating Button
   ============================================ */

.whatsapp-float {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 9998;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
}

.whatsapp-float:active {
    transform: scale(0.98);
}

.whatsapp-float svg {
    width: 28px;
    height: 28px;
}

/* Adjust for mobile when bottom nav is visible */
.mobile-nav ~ .whatsapp-float,
body:has(.mobile-nav) .whatsapp-float {
    bottom: 80px;
}

/* Desktop: slightly higher */
@media (min-width: 768px) {
    .whatsapp-float {
        bottom: 24px;
        right: 24px;
    }
}
