/**
 * FRAMIZE - Professional Design System & Responsive Styles
 * Polished for Mobile (Android & iPhone), Tablet, Laptop, and Desktop.
 */

:root {
    --primary-blue: #1d4ed8;
    --primary-blue-light: #2563eb;
    --primary-blue-dark: #1e3a8a;
    --primary-blue-hover: #1e40af;
    --primary-subtle: #eff6ff;
    --accent-emerald: #10b981;
    --accent-emerald-light: #d1fae5;
    --bg-page: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-sheet: 0 12px 32px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    background-image:
        radial-gradient(at 0% 0%, rgba(224, 231, 255, 0.45) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(219, 234, 254, 0.35) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Touch Friendly Targets */
button, .btn, input, select, textarea, .nav-link {
    touch-action: manipulation;
}

.btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
    min-height: 34px;
}

/* Navbar Header */
.navbar-public {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
    min-width: 0;
}

.brand-logo:hover {
    opacity: 0.92;
}

.brand-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.brand-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary-blue-dark);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0;
}

.brand-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 575.98px) {
    .navbar-public {
        padding: 0.6rem 0;
    }
    .brand-icon {
        width: 34px;
        height: 34px;
        font-size: 1.05rem;
        border-radius: 0.5rem;
    }
    .brand-name {
        font-size: 1.05rem;
    }
    .brand-sub {
        font-size: 0.65rem;
        max-width: 135px;
    }
}

/* Main Content & Footer */
.main-container {
    flex: 1;
    padding: 1.75rem 0 3rem 0;
}

@media (max-width: 575.98px) {
    .main-container {
        padding: 1.15rem 0 2.25rem 0;
    }
}

.footer-public {
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 1.25rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto;
}

.hover-primary {
    transition: color 0.2s ease;
}

.hover-primary:hover {
    color: var(--primary-blue) !important;
    text-decoration: underline !important;
}

/* Responsive Step Wizard */
.step-wizard {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0.75rem 0 2rem 0;
    padding: 0;
}

.step-wizard::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 12.5%;
    right: 12.5%;
    height: 3px;
    background: #e2e8f0;
    z-index: 1;
    border-radius: 4px;
}

.step-item {
    position: relative;
    z-index: 2;
    text-align: center;
    background: transparent;
    padding: 0 0.2rem;
    min-width: 0;
    width: 100%;
    transition: transform 0.2s ease;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.35rem auto;
    font-size: 0.9rem;
    box-shadow: 0 0 0 4px var(--bg-page);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.step-item.active .step-circle {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18), 0 4px 8px rgba(37, 99, 235, 0.2);
}

.step-item.completed .step-circle {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-color: #10b981;
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--bg-page), 0 2px 6px rgba(16, 185, 129, 0.25);
}

.step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    line-height: 1.25;
    word-break: break-word;
}

.step-item.active .step-label {
    color: var(--primary-blue-light);
    font-weight: 700;
}

.step-item.completed .step-label {
    color: #059669;
}

@media (max-width: 575.98px) {
    .step-wizard {
        margin: 0.25rem 0 1.35rem 0;
        padding: 0;
    }
    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    .step-wizard::before {
        top: 16px;
        left: 12%;
        right: 12%;
        height: 2px;
    }
    .step-label {
        font-size: 0.66rem;
        line-height: 1.15;
    }
}

/* Card & Interactive UI */
.card-custom {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (max-width: 575.98px) {
    .card-custom {
        border-radius: 0.875rem;
    }
}

.btn-custom-primary {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-weight: 600;
    padding: 0.65rem 1.35rem;
    border-radius: 50rem;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-custom-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-custom-light {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-weight: 600;
    padding: 0.65rem 1.35rem;
    border-radius: 50rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-custom-light:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

/* Photo Upload Box */
.photo-upload-card {
    border: 2px dashed #cbd5e1 !important;
    background-color: #ffffff !important;
    transition: all 0.22s ease-in-out;
    border-radius: var(--radius-lg) !important;
}

.photo-upload-card:hover {
    border-color: var(--primary-blue-light) !important;
    background-color: #f8fafc !important;
    box-shadow: var(--shadow-md);
}

.photo-upload-card.has-file {
    border: 2px solid #93c5fd !important;
    background-color: #eff6ff !important;
    box-shadow: var(--shadow-sm);
}

/* PDF Preview Sheet Container */
.pdf-sheet-wrapper {
    width: 100%;
    margin-bottom: 2rem;
}

.pdf-sheet-page {
    background-color: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(203, 213, 225, 0.85);
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sheet);
}

.sheet-frame-header {
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    text-align: center;
    padding: 0.5rem;
}

.sheet-judul-text {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1.5rem);
    line-height: 1.35;
    color: #1e3a8a !important;
    letter-spacing: -0.01em;
}

/* Cover Title Inside A4 Preview Box */
.cover-title-overlay {
    position: absolute;
    top: 59%;
    height: 28%;
    left: 12%;
    right: 12%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.25rem 0.5rem;
    overflow: hidden;
}

.cover-title-heading {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.72rem, 2.6vw, 1.55rem);
    line-height: 1.3;
    color: #1e3a8a !important;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin: 0;
    width: 100%;
}

@media (max-width: 575.98px) {
    .cover-title-overlay {
        padding: 0.15rem 0.35rem;
    }
    .cover-title-heading {
        font-size: clamp(0.65rem, 3.2vw, 0.95rem);
        line-height: 1.25;
    }
}

.sheet-page-footer {
    margin-top: auto;
    padding: 0.65rem 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    background: #fafafa;
    flex-wrap: wrap;
    gap: 0.35rem;
}

@media (max-width: 575.98px) {
    .sheet-page-footer {
        padding: 0.5rem 0.75rem;
        font-size: 0.68rem;
    }
}

/* Sticky Page Navigation Bar in Preview */
.preview-sticky-nav {
    position: sticky;
    top: 66px;
    z-index: 1010;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 575.98px) {
    .preview-sticky-nav {
        top: 56px;
        padding: 0.6rem 0.75rem !important;
    }
    .mobile-stack-btns {
        width: 100%;
    }
    .mobile-stack-btns > .btn,
    .mobile-stack-btns > form,
    .mobile-stack-btns > form > .btn {
        width: 100%;
    }
}

/* Responsive Table & Overflow Prevention */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Form Controls */
.form-control:focus, .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.15);
}

/* Prevent horizontal scroll */
img, svg, video, canvas, audio, iframe, embed, object {
    max-width: 100%;
    height: auto;
}
