@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Raleway:wght@300;400;500;600&family=Cinzel:wght@400;600&display=swap');

:root {
    --gold:          #C9A84C;
    --gold-light:    #E8D5A3;
    --gold-dark:     #9A7A2E;
    --gold-gradient: linear-gradient(135deg, #C9A84C 0%, #E8D5A3 55%, #C9A84C 100%);
    --gold-btn:      linear-gradient(135deg, #C9A84C 0%, #D4AF60 100%);
    --dark:          #0D0B08;
    --ivory:         #FAF8F4;
    --cream:         #F2EDE4;
    --white:         #FFFFFF;
    --text-dark:     #1C1810;
    --text-mid:      #4A3F32;
    --border-gold:   rgba(201,168,76,0.28);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Raleway', sans-serif;
    background: var(--ivory);
    color: var(--text-dark);
    margin: 0;
    min-height: 100vh;
}

/* Page Toggling Logic */
.page { display: none; }
.page.active { display: block; }

.p {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    height: 100vh;
    padding: 40px 20px;
}

/* Page 1 Specifics */
.pg1 {
    background: var(--ivory);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201,168,76,0.14) 0%, transparent 70%),
        linear-gradient(180deg, #FFFFFF 0%, #FAF8F4 58%, #F2EDE4 100%);
    position: relative;
}

.pg1::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(201,168,76,0.08) 80px, rgba(201,168,76,0.08) 81px);
    pointer-events: none;
}

.head1 {
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    font-weight: 500;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 16px;
    text-align: center;
    width: 100%;
}

.head2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-dark);
    text-align: center;
}

.head3 {
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    letter-spacing: 3px;
    color: var(--text-mid);
    text-transform: uppercase;
}

/* Button Styling */
#get-btn, .get-btn {
    background: var(--white);
    border: 1.5px solid var(--gold);
    color: var(--gold);
    padding: 14px 56px;
    border-radius: 2px;
    font-family: 'Raleway', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.35s ease;
}

#get-btn:hover, .get-btn:hover {
    background: var(--gold-btn);
    color: var(--dark);
    box-shadow: 0 8px 32px rgba(201,168,76,0.3);
}

/* Page 2 Specifics */
.pg2 {
    background: var(--ivory);
    background-image:
        radial-gradient(ellipse 70% 50% at 50% 50%, rgba(201,168,76,0.12) 0%, transparent 70%),
        linear-gradient(180deg, #FFFFFF 0%, #FAF8F4 55%, #F2EDE4 100%);
}

.pg2-head1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    font-weight: 600;
    text-align: center;
    max-width: 640px;
    margin-bottom: 32px;
}

.consent-card {
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-gold);
    padding: 40px 44px;
    max-width: 500px;
    box-shadow: 0 24px 60px rgba(28,24,16,0.12);
    margin-bottom: 30px;
}

.consent-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 20px;
}

#consent-btn {
    background: var(--gold-btn);
    color: var(--dark);
    padding: 14px 56px;
    border: none;
    cursor: pointer;
}
#consent-btn:hover {
    box-shadow: 0 12px 32px rgba(201,168,76,0.45);
    transform: translateY(-2px);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, #ff6b6b, #feca57, #48cae4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

header p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 55% 1fr;
    gap: 25px;
    align-items: start;
}

/* Preview Panel - Square Container */
.small-box-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.preview-panel {
    position: relative;
}

.image-container {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    background: #f8f9fa;
    /* Portrait layout for the camera */
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
}

#webcam-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    background: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    background: #fff;
}

#uploaded-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 15px;
    background: #fff;
}

#uploaded-image {
    display: none;
}

.cropper-point {
    width: 15px !important;
    height: 15px !important;
    background-color: #c9a84c !important; /* Match theme color */
    opacity: 0.9 !important;
    border-radius: 50% !important; /* Make them nice circles */
}

/* Adjust alignments so the circles stay centered on the borders */
.cropper-point.point-e { right: -7px !important; margin-top: -7px !important; }
.cropper-point.point-n { top: -7px !important; margin-left: -7px !important; }
.cropper-point.point-w { left: -7px !important; margin-top: -7px !important; }
.cropper-point.point-s { bottom: -7px !important; margin-left: -7px !important; }
.cropper-point.point-ne { top: -7px !important; right: -7px !important; }
.cropper-point.point-nw { top: -7px !important; left: -7px !important; }
.cropper-point.point-sw { bottom: -7px !important; left: -7px !important; }
.cropper-point.point-se { bottom: -7px !important; right: -7px !important; width: 18px !important; height: 18px !important; } /* Make bottom right slightly larger for primary dragging */

/* Controls */
.controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
}

.control-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.control-btn .material-icons {
    font-size: 16px;
}

/* Jewelry Panel */
.Jewelry-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 75vh;
    overflow-y: auto;
}

/* Upload Section */
.upload-section {
    margin-bottom: 20px;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: var(--gold-btn);
    color: var(--dark);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(201, 168, 76, 0.2);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 168, 76, 0.4);
    background: linear-gradient(135deg, #d4af37 0%, #c5a017 100%);
}

.upload-btn .material-icons {
    font-size: 20px;
}

#file-upload {
    display: none;
}

#file-capture {
    display: none;
}

/* Jewelry Types */
.Jewelry-types {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.Jewelry-type {
    background: rgba(248, 250, 252, 0.6);
    border-radius: 15px;
    padding: 18px;
    border: 1px solid rgba(226, 232, 240, 0.3);
    transition: all 0.3s ease;
}

.Jewelry-type:hover {
    background: rgba(248, 250, 252, 0.8);
    border-color: rgba(102, 126, 234, 0.2);
}

.type-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.type-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-header .material-icons {
    color: var(--gold);
    font-size: 1.3rem;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 28px;
}

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

input:checked + .slider {
    background: var(--gold-btn);
}

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

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.items:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: rgba(102, 126, 234, 0.3);
}

.Jewelry-btn {
    width: 100%;
    height: 100px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    background: #f8f9fa;
    transition: all 0.3s ease;
    position: relative;
}

.Jewelry-btn:hover {
    transform: scale(1.03);
}

.Jewelry-btn.active {
    border: 2px solid #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
}

.Jewelry-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.buynow-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.buynow-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

/* Scrollbar Styling */
.Jewelry-panel::-webkit-scrollbar {
    width: 6px;
}

.Jewelry-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.Jewelry-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
}

.Jewelry-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .small-box-container {
        position: sticky;
        top: 10px;
        z-index: 100;
        padding: 15px;
    }

    .image-container {
        max-height: 40vh;
        width: auto;
        aspect-ratio: 3/4;
        margin: 0 auto;
    }
    
    .Jewelry-panel {
        max-height: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        margin-bottom: 15px;
        padding: 10px 0;
    }
    
    header h1 {
        font-size: 2rem;
        margin-bottom: 0;
    }
    
    header p {
        display: none; /* Hide subtitle to save vertical space */
    }
    
    .small-box-container {
        padding: 10px;
        border-radius: 15px;
    }

    .Jewelry-panel {
        padding: 20px;
        border-radius: 15px;
    }
    
    .image-container {
        width: 100%;
        max-height: none;
        aspect-ratio: 3/4;          /* was 9/16 — this is the main fix */
        transition: aspect-ratio 0.3s ease;
    }

    .image-container.photo-taken {
        aspect-ratio: 3/4 !important;  /* keep same, no change needed */
    }
    
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .items {
        padding: 10px;
    }
    
    .Jewelry-btn {
        height: 90px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .type-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .switch {
        width: 45px;
        height: 25px;
    }
    
    .slider:before {
        height: 19px;
        width: 19px;
        left: 3px;
        bottom: 3px;
    }
    
    input:checked + .slider:before {
        transform: translateX(20px);
    }
    
    .Jewelry-btn {
        height: 80px;
    }
}

/* Animation Effects */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.6s ease-out;
}

/* Improved Visual Hierarchy */
.small-box-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.Jewelry-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Camera placeholder text removed as per updated UI */