/**
 * PHOTOBOOTH WEB APPLICATION - STYLES
 * Layout: Input + A4 Preview | Strip | Reorder + Export
 * Theme: Baby Pink
 */

:root {
    --primary: #f472b6;
    --primary-light: #f9a8d4;
    --primary-dark: #ec4899;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --secondary: #9ca3af;

    --bg-dark: #1a1a2e;
    --bg-card: #2d2d44;
    --bg-card-hover: #3d3d5c;
    --text-primary: #fdf2f8;
    --text-secondary: #d1d5db;
    --border-color: #4a4a6a;

    --glass-bg: rgba(45, 45, 68, 0.95);
    --glass-border: rgba(244, 114, 182, 0.2);

    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 10px 25px -5px rgba(236, 72, 153, 0.2);
    --transition: all 0.2s ease;
}

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

html,
body {
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d1f3d 50%, #1a1a2e 100%);
    color: var(--text-primary);
    font-size: 13px;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    overflow: hidden;
}

.app-header {
    text-align: center;
    padding: 4px 0;
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-light), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-header h1 i {
    -webkit-text-fill-color: var(--primary-light);
    margin-right: 6px;
}

/* ===== MAIN LAYOUT ===== */
.main-content {
    flex: 1;
    display: flex;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

/* ===== CARDS ===== */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 12px;
    overflow: hidden;
}

.card h2 {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card h2 i {
    color: var(--primary-light);
    font-size: 0.85rem;
}

/* ===== LEFT COLUMN ===== */
.left-column {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 100%;
    overflow: hidden;
}

.card-input .input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.card-input .input-row:last-of-type {
    margin-bottom: 0;
}

.background-preview {
    margin-top: 8px;
}

.background-preview img {
    width: 100%;
    max-height: 50px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* A4 Preview Card */
.card-a4 {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.a4-preview-container {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    padding: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    margin-bottom: 8px;
    overflow: hidden;
}

#a4Canvas {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.size-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 8px 10px;
    border-radius: var(--radius);
    flex-shrink: 0;
    overflow: hidden;
}

.size-control label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.size-control label i {
    color: var(--primary-light);
}

.size-control input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 4px;
    border-radius: 2px;
    background: var(--bg-card-hover);
    -webkit-appearance: none;
    appearance: none;
}

.size-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

#scaleValue {
    min-width: 35px;
    text-align: center;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

/* ===== CENTER COLUMN - STRIP ===== */
.center-column {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

.card-strip {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.strip-container {
    flex: 1;
    background: linear-gradient(145deg, #1a1a1a, #252525);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    border: 1px dashed var(--border-color);
}

#stripCanvas {
    max-height: 100%;
    width: auto;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* ===== RIGHT COLUMN ===== */
.right-column {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 100%;
    overflow: hidden;
}

/* Reorder Card */
.card-reorder {
    flex-shrink: 0;
}

.photo-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.photo-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 10px;
    transition: var(--transition);
}

.photo-slot:hover {
    border-color: var(--primary);
}

.photo-slot.has-photo {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.slot-placeholder {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
}

.slot-thumbnail {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 3px;
}

.slot-controls {
    display: flex;
    gap: 4px;
}

/* Export Card */
.card-export {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.export-info {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 8px;
    margin-bottom: 10px;
}

.export-info p {
    font-size: 0.65rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.export-info i {
    color: var(--warning);
}

.save-status {
    font-size: 0.7rem;
    text-align: center;
    padding: 4px 0;
}

.save-status.success {
    color: var(--success);
}

.save-status.error {
    color: var(--danger);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.btn-sm {
    padding: 5px 8px;
    font-size: 0.65rem;
    flex: none;
}

.btn-full {
    width: 100%;
    flex: none;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    flex: none;
    padding: 8px 12px;
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary-light);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary);
    color: white;
}

.btn-icon {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.6rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
}

/* ===== CAMERA MODAL ===== */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.camera-modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.btn-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--danger);
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.capture-status {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.captured-preview {
    display: none;
    width: 100%;
    height: 100%;
}

.captured-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.countdown-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 7rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    animation: pulse-countdown 1s infinite;
}

@keyframes pulse-countdown {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn-action {
    padding: 12px 35px;
    font-size: 0.95rem;
    font-weight: 600;
}

/* ===== RESPONSIVE - TABLET (768px - 1024px) ===== */
@media (max-width: 1024px) {
    .app-container {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .main-content {
        flex-direction: column;
        overflow: visible;
    }

    .left-column,
    .right-column {
        flex: none;
        width: 100%;
        max-height: none;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .left-column .card,
    .right-column .card {
        flex: 1;
        min-width: 280px;
    }

    .center-column {
        order: -1;
        width: 100%;
    }

    .card-strip {
        width: 100%;
    }

    .strip-container {
        min-height: 400px;
    }

    html,
    body {
        height: auto;
        overflow: auto;
    }
}

/* ===== RESPONSIVE - MOBILE (max 767px) ===== */
@media (max-width: 767px) {
    body {
        font-size: 15px;
    }

    .app-container {
        padding: 10px;
    }

    .app-header h1 {
        font-size: 1.3rem;
    }

    .main-content {
        flex-direction: column;
        gap: 10px;
    }

    .left-column,
    .right-column {
        flex-direction: column;
        width: 100%;
    }

    .left-column .card,
    .right-column .card {
        min-width: 100%;
    }

    .center-column {
        order: -1;
    }

    .strip-container {
        min-height: 200px;
        max-height: 300px;
        padding: 10px;
    }

    #stripCanvas {
        max-height: 280px;
    }

    .card {
        padding: 12px;
    }

    .card h2 {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    .card-input .input-row {
        flex-direction: column;
    }

    .card-input .input-row .btn {
        width: 100%;
    }

    .photo-slots {
        flex-direction: row;
        gap: 8px;
    }

    .photo-slot {
        flex: 1;
        flex-direction: column;
        padding: 10px;
        text-align: center;
    }

    .slot-placeholder {
        font-size: 0.9rem;
    }

    .slot-controls {
        margin-top: 6px;
    }

    .export-buttons {
        gap: 10px;
    }

    .btn {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .export-info p {
        font-size: 0.8rem;
    }

    .size-control label {
        font-size: 0.85rem;
    }

    #scaleValue {
        font-size: 0.85rem;
    }

    /* Camera Modal Mobile */
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .countdown-display {
        font-size: 5rem;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .btn-action {
        width: 100%;
        padding: 12px 20px;
    }

    .video-container {
        aspect-ratio: 4/3;
    }
}

/* ===== RESPONSIVE - SMALL MOBILE (max 480px) ===== */
@media (max-width: 480px) {
    .app-header {
        padding: 4px 0;
    }

    .app-header h1 {
        font-size: 0.9rem;
    }

    .strip-container {
        min-height: 300px;
    }

    .photo-slots {
        flex-direction: column;
    }

    .photo-slot {
        flex-direction: row;
        justify-content: space-between;
    }

    .slot-controls {
        margin-top: 0;
    }

    .countdown-display {
        font-size: 4rem;
    }

    .size-control {
        flex-wrap: wrap;
    }

    .size-control label {
        width: 100%;
        margin-bottom: 4px;
    }
}
