/* ============================================
   Clothing Matcher Styles
   ============================================ */

:root {
    --primary-color: #c19a5d;
    --secondary-color: #d4a574;
    --accent-color: #8b4513;
    --text-dark: #333;
    --text-light: #666;
    --text-lighter: #888;
    --bg-light: #fafafa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    min-height: 100vh;
}

/* ============================================
   Navigation Integration
   ============================================ */
.top-nav .nav-menu li a[href*="clothing-matcher"] {
    color: var(--primary-color);
    font-weight: 600;
}

/* ============================================
   Layout Containers
   ============================================ */
.matcher-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 9rem 1rem 2rem 1rem;
    min-height: calc(100vh - 200px);
}

.matcher-header {
    text-align: center;
    margin-bottom: 3rem;
}

.matcher-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.matcher-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* ============================================
   Upload Section
   ============================================ */
.upload-section {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition-smooth);
    cursor: pointer;
    background: var(--bg-light);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(193, 154, 93, 0.05) 0%, rgba(212, 165, 116, 0.1) 100%);
}

.upload-area.dragging {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(193, 154, 93, 0.1) 0%, rgba(212, 165, 116, 0.2) 100%);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.upload-text {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.upload-form {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition-smooth);
    background: var(--bg-white);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(193, 154, 93, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.tag-input-container {
    position: relative;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.tag-suggestion {
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tag-suggestion:hover {
    background: var(--bg-light);
}

/* ============================================
   Category Limits Display
   ============================================ */
.limits-display {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.limits-title {
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.limit-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.limit-category {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.limit-count {
    font-size: 1.2rem;
    font-weight: 700;
}

.limit-count.warning {
    color: #ffc107;
}

.limit-count.maxed {
    color: #dc3545;
}

/* ============================================
   Auth Promo Section (Unlock Unlimited)
   ============================================ */
.auth-promo-section {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 0;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    overflow: hidden;
}

.promo-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.promo-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.promo-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.promo-text {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
}

.promo-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.promo-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.promo-feature .feature-icon {
    font-size: 1.2rem;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.auth-tab:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.auth-tab.active {
    color: var(--primary-color);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* Auth Panels */
.auth-panel {
    padding: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form .form-group {
    margin-bottom: 0;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.auth-help {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.auth-help a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.auth-help a:hover {
    text-decoration: underline;
}

/* Social Auth Styles */
.social-auth-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 1rem 0;
    width: 100%;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-white);
    color: #333;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-social:hover {
    background-color: var(--bg-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn-social img {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}

.btn-google {
    color: #3c4043;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-lighter);
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 15px;
}

/* Limit Warning */
.limit-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.warning-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.warning-icon {
    font-size: 1.5rem;
}

.warning-text {
    flex: 1;
    min-width: 200px;
}

.warning-text strong {
    color: #856404;
    display: block;
    margin-bottom: 0.25rem;
}

.warning-text p {
    margin: 0;
    color: #6d5700;
    font-size: 0.9rem;
}

/* Legacy Verification Section (keep for backwards compat) */
.verification-section {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    text-align: center;
}

.verification-title {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

.verification-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
}

/* ============================================
   Wardrobe Grid
   ============================================ */
.wardrobe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.wardrobe-item {
    background: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    cursor: pointer;
    position: relative;
}

.wardrobe-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.wardrobe-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.wardrobe-info {
    padding: 1rem;
}

.wardrobe-category {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.wardrobe-brand {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.wardrobe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.wardrobe-tag {
    background: var(--bg-light);
    color: var(--text-light);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.wardrobe-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-smooth);
}

.wardrobe-item:hover .wardrobe-delete {
    opacity: 1;
}

/* ============================================
   Matching Interface (Clueless Style)
   ============================================ */
.matcher-interface {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.match-header {
    text-align: center;
    margin-bottom: 2rem;
}

.match-title {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.match-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
}

.match-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.match-card {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    aspect-ratio: 3/4;
    position: relative;
    overflow: hidden;
}

.match-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.match-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    color: white;
    padding: 1.5rem 1rem 1rem;
    transform: translateY(100%);
    transition: var(--transition-smooth);
}

.match-card:hover .match-item-info {
    transform: translateY(0);
}

.match-item-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.match-item-brand {
    font-size: 0.9rem;
    opacity: 0.9;
}

.match-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.match-button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.match-button.like {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.match-button.like:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.match-button.dislike {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.match-button.dislike:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

.match-button.skip {
    background: var(--bg-light);
    color: var(--text-light);
    border: 2px solid var(--border-color);
}

.match-button.skip:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

.match-score {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.match-score-value {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(193, 154, 93, 0.3);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Navigation Tabs
   ============================================ */
.matcher-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.nav-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-radius: 8px 8px 0 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-light);
}

.nav-tab.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.nav-tab:hover:not(.active) {
    background: var(--bg-light);
    color: var(--text-dark);
}

/* ============================================
   Loading States
   ============================================ */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    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);
    }
}

.loading-text {
    margin-left: 1rem;
    color: var(--text-light);
}

/* ============================================
   Notifications
   ============================================ */
.matcher-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-white);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    z-index: 1000;
    transform: translateX(400px);
    transition: var(--transition-smooth);
}

.matcher-notification.show {
    transform: translateX(0);
}

.notification-success {
    border-left: 4px solid #28a745;
}

.notification-error {
    border-left: 4px solid #dc3545;
}

.notification-warning {
    border-left: 4px solid #ffc107;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .matcher-container {
        padding: 10rem 0.5rem 2rem 0.5rem;
    }

    .matcher-title {
        font-size: 2rem;
    }

    .wardrobe-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .match-card {
        max-width: 300px;
        aspect-ratio: 1;
    }

    .match-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .match-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .limits-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .upload-form {
        grid-template-columns: 1fr;
    }

    .verification-form {
        flex-direction: column;
        max-width: 100%;
    }

    /* Auth Promo Section Mobile */
    .promo-features {
        flex-direction: column;
        gap: 0.75rem;
    }

    .promo-title {
        font-size: 1.5rem;
    }

    .promo-text {
        font-size: 1rem;
    }

    .auth-panel {
        padding: 1.5rem;
    }

    .warning-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .matcher-container {
        padding: 8rem 0.5rem 2rem 0.5rem;
    }

    .matcher-title {
        font-size: 1.5rem;
    }

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

    .upload-area {
        padding: 2rem 1rem;
    }

    .match-card {
        max-width: 250px;
    }

    .match-controls {
        gap: 0.5rem;
    }

    .nav-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   Outfit Card Styles (Clueless Experience)
   ============================================ */
.outfit-card {
    background: var(--bg-white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    transition: transform 0.3s ease;
}

.outfit-card:active {
    cursor: grabbing;
}

.outfit-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.outfit-header h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.outfit-header p {
    opacity: 0.9;
    font-size: 1rem;
}

.outfit-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-light);
}

.outfit-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.outfit-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.outfit-item-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.outfit-item-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: white;
    padding: 0.75rem 0.5rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.outfit-details {
    padding: 1.5rem;
    text-align: center;
    background: white;
}

.match-score-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.match-label {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}

.outfit-occasion {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    display: inline-block;
}

/* ============================================
   Touch Support for Mobile Swiping
   ============================================ */
@media (pointer: coarse) {
    .match-card {
        touch-action: pan-y;
    }

    .outfit-card {
        touch-action: pan-y;
    }

    .match-button {
        touch-action: manipulation;
        min-height: 44px;
        min-width: 44px;
    }

    .outfit-items {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1rem;
    }

    .outfit-item-image {
        height: 100px;
    }
}

/* ============================================
   Animations
   ============================================ */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}