/* ==========================================================================
   Studique Credentials - High-End Studio Orange & Obsidian Black Design System
   Figment: Designing for Human Behaviour • Certificate Portal
   ========================================================================== */

:root {
    --bg-base: #060609;
    --bg-surface: #08080C;
    --bg-surface-elevated: #111118;
    --bg-glass: rgba(8, 8, 12, 0.96);

    --brand-orange: #FF652F;
    --brand-orange-light: #FF8552;
    --brand-orange-dark: #E04E1B;
    --brand-orange-glow: rgba(255, 101, 47, 0.38);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --border-brand: rgba(255, 101, 47, 0.5);

    --text-primary: #FFFFFF;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;

    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-script: 'Caveat', cursive;

    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-full: 9999px;

    --transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    background-color: #060609;
    background-image: 
        radial-gradient(circle at 50% 12%, rgba(255, 101, 47, 0.14) 0%, transparent 60%),
        radial-gradient(circle at 12% 88%, rgba(255, 80, 20, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 88% 88%, rgba(255, 130, 40, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, #08080C 0%, #050508 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 0. Global Utility */
.hidden {
    display: none !important;
}

/* 1. Aceternity UI: 3D Background Cubes Grid */
.cubes-bg-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    background-color: transparent;
}

.cubes-bg-container canvas.cubes-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    outline: none;
}

/* Dynamic Cursor Ambient Vignette */
.aceternity-spotlight {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
        900px circle at var(--mouse-x, 50%) var(--mouse-y, 30%), 
        rgba(255, 101, 47, 0.09), 
        transparent 70%
    );
    transition: opacity 0.3s ease;
}

/* 2. Layout Wrapper - Single Viewport Centered (Non-Scrollable, First Display) */
.app-layout {
    position: relative;
    z-index: 2;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 3. Event Card - Optimized Space Utilization & Razor-Clean Geometry */
.event-card-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-height: 100%;
}

.event-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    width: min(580px, 92vw, calc(100vh - 130px));
    max-width: 100%;
    margin: auto;
    box-shadow: none !important;
}

/* Square Poster with Thick Inside Orange Gradient Stroke (No Shadows, Sharp, Position Locked) */
.event-poster-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: 0;
    overflow: hidden;
    background: #08080C;
    box-shadow: none !important;
    margin: 0;
}

/* On hover: NEVER change poster position */
.event-poster-wrapper:hover {
    transform: none !important;
    box-shadow: none !important;
}

.event-poster-inner {
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    background: #08080C;
    position: relative;
}

.event-poster-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 0;
    user-select: none;
    -webkit-user-drag: none;
}

/* 4px Inside Gradient Stroke: Pure Studio Orange (No Black) */
.event-poster-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 4px solid transparent;
    border-image: linear-gradient(135deg, #FF652F 0%, #FF8A50 35%, #FFA878 70%, #FF5515 100%) 1;
    pointer-events: none;
    z-index: 3;
}

/* Event Info Row (Single Row on ALL devices including phones) */
.event-info-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px;
    width: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.event-card-title {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3.2vw, 1.95rem);
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.6px;
    line-height: 1;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

/* Get Certificate Button: Black Text, Pure Text (No Symbols), No Shadow, Hover Color Darkens */
.btn-get-certificate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #FF652F;
    color: #000000 !important;
    border: none;
    font-family: var(--font-display);
    font-size: clamp(0.85rem, 2.2vw, 0.98rem);
    font-weight: 800;
    padding: 13px 24px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: -0.2px;
    flex-shrink: 0;
    margin: 0;
    box-shadow: none !important;
    transition: background 0.16s ease;
    will-change: transform;
}

/* On hover: DARKEN button, magnetic spring handles position */
.btn-get-certificate:hover {
    box-shadow: none !important;
    background: #E04E1B !important;
}

.btn-get-certificate:active {
    box-shadow: none !important;
    background: #C83C10 !important;
}


/* 4. Modal Backdrop & Dialog (Consistent Solid Obsidian #08080C, Clean Solid Border) */
.cert-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 4, 6, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

.cert-modal-backdrop.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.cert-modal-dialog {
    background: #08080C !important;
    color: #FFFFFF;
    border: 1px solid #1E1E2C !important;
    border-radius: 6px;
    padding: 16px 24px 28px 24px;
    width: 100%;
    max-width: 440px;
    max-height: 94vh;
    overflow-y: auto;
    position: relative;
    box-shadow: none !important;
    transition: max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    animation: modalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cert-modal-dialog.preview-mode {
    max-width: 680px;
    padding: 16px 24px 24px 24px;
    background: #08080C !important;
    border: 1px solid #1E1E2C !important;
}

@keyframes modalPopIn {
    from { transform: scale(0.97); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Dedicated Row 1 for Close Icon: Zero overlap with heading */
.modal-top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

.modal-close-btn {
    position: static !important;
    top: auto;
    right: auto;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none;
    color: #717182;
    cursor: pointer;
    line-height: 1;
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.16s ease;
    z-index: 10;
}

.modal-close-btn svg {
    display: block;
    width: 15px;
    height: 15px;
    stroke-width: 2.2;
}

.modal-close-btn:hover {
    transform: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #FFFFFF;
}

/* 5. Modal View 1: Clean Email Form */
.modal-view-panel {
    width: 100%;
    animation: fadeIn 0.22s ease;
}

.modal-header-wrap {
    text-align: center;
    margin-bottom: 22px;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.6px;
    margin: 0;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: #8E8EA0;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: #0E0E14;
    border: 1px solid #222230;
    border-radius: 4px;
    padding: 14px 16px;
    font-size: 0.95rem;
    color: #FFFFFF;
    outline: none;
    font-family: inherit;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.form-input:focus {
    background: #12121C;
    border-color: var(--brand-orange);
}

.form-input::placeholder {
    color: #4C4C5C;
}

.modal-status-alert {
    padding: 12px 14px;
    border-radius: 4px;
    font-size: 0.86rem;
    line-height: 1.4;
    margin-bottom: 16px;
    text-align: center;
}

.modal-status-alert.error {
    background: #140A0A;
    border: 1px solid #3F1A1A;
    color: #FCA5A5;
    display: block;
}

.modal-status-alert.success {
    background: #0E150E;
    border: 1px solid #1A3F1A;
    color: #86EFAC;
    display: block;
}

/* Generate Certificate Submit Button: Black Text, No Shadow, Darkens on Hover */
.btn-modal-primary {
    width: 100%;
    background: #FF652F;
    color: #000000 !important;
    border: none;
    border-radius: 6px;
    font-family: var(--font-display);
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none !important;
    transition: background 0.16s ease;
    will-change: transform;
}

.btn-modal-primary:hover:not(:disabled) {
    box-shadow: none !important;
    background: #E04E1B !important;
}

.btn-modal-primary:active:not(:disabled) {
    box-shadow: none !important;
    background: #C83C10 !important;
}

.btn-modal-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* 6. Modal View 2: Live Canvas Preview & Single Download Action */
.cool-canvas-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 2264 / 1600;
    border-radius: 2px;
    overflow: hidden;
    background: #000000;
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 18px;
}

#certCanvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Aceternity UI: Image Generation Loader Overlay & Canvas */
.image-generation-overlay {
    pointer-events: none;
    position: absolute;
    inset: 0;
    background: #08080C;
    z-index: 10;
    will-change: clip-path;
    transition: opacity 0.3s ease;
}

.image-generation-loader-canvas {
    pointer-events: none;
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    z-index: 12;
    transition: opacity 0.35s ease;
}

.download-actions-grid {
    display: flex;
    width: 100%;
    margin: 0;
}

/* Download Certificate Button: Black Text, Pure Text (No Symbols), No Shadow, Darkens on Hover */
.btn-download-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #FF652F;
    color: #000000 !important;
    border: none;
    border-radius: 6px;
    font-family: var(--font-display);
    padding: 14px 22px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: none !important;
    transition: background 0.16s ease;
    will-change: transform;
}

.btn-download-primary:hover {
    box-shadow: none !important;
    background: #E04E1B !important;
}

.btn-download-primary:active {
    box-shadow: none !important;
    background: #C83C10 !important;
}

/* Spinner */
.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.35);
    border-top-color: #000000;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { rotate: 360deg; }
}

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

/* Responsive adjustments (iPhone & Mobile): ALWAYS Single Row */
@media (max-width: 600px) {
    .app-layout {
        padding: 14px;
    }

    .event-card {
        gap: 14px;
    }

    .event-info-bar {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    .event-card-title {
        font-size: clamp(1.25rem, 5vw, 1.6rem);
    }

    .btn-get-certificate {
        padding: 12px 18px;
        font-size: clamp(0.82rem, 3.4vw, 0.94rem);
        white-space: nowrap;
    }

    .cert-modal-dialog {
        padding: 14px 18px 22px 18px;
    }

    .cert-modal-dialog.preview-mode {
        padding: 14px 16px 18px 16px;
    }
}
