/* ========================================
   STORY CREATOR COMPONENT STYLES
   Modal for creating new stories
   ======================================== */

.story-creator-modal {
    position: fixed;
    inset: 0;
    z-index: 10025;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.story-creator-modal.show {
    opacity: 1;
    visibility: visible;
}

.story-creator-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.story-creator-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: #1f2937;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.story-creator-modal.show .story-creator-container {
    transform: translateY(0);
}

/* ========================================
   HEADER
   ======================================== */

.story-creator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.story-creator-header h2 {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.story-creator-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.story-creator-close:hover {
    background: rgba(255,255,255,0.2);
}

.story-creator-publish {
    padding: 8px 20px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-creator-publish:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.story-creator-publish:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   REMAINING COUNTER
   ======================================== */

.story-creator-remaining {
    padding: 8px 20px;
    background: rgba(34, 197, 94, 0.1);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.story-creator-remaining span {
    color: #22c55e;
    font-size: 13px;
    font-weight: 500;
}

/* ========================================
   CONTENT AREA
   ======================================== */

.story-creator-content {
    flex: 1;
    padding: 24px 20px;
    overflow-y: auto;
}

/* Upload area */
.story-creator-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.upload-options {
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

.upload-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: rgba(255,255,255,0.05);
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    max-width: 160px;
}

.upload-option:hover {
    background: rgba(255,255,255,0.1);
    border-color: #22c55e;
}

.upload-option:active {
    transform: scale(0.98);
}

.upload-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #22c55e;
}

.upload-option span {
    font-size: 14px;
    font-weight: 500;
}

.upload-hint {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    margin: 0;
}

/* Preview area */
.story-creator-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.preview-media {
    width: 100%;
    max-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-media img,
.preview-media video {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.preview-remove {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    border-radius: 20px;
    color: #ef4444;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-remove:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ========================================
   PROGRESS
   ======================================== */

.story-creator-progress {
    padding: 16px 20px;
    background: rgba(34, 197, 94, 0.1);
    border-top: 1px solid rgba(255,255,255,0.05);
}

.progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.story-creator-progress span {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

/* ========================================
   CAMERA MODAL
   ======================================== */

.story-camera-modal {
    position: fixed;
    inset: 0;
    z-index: 10030;
    background: #000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.story-camera-modal.show {
    opacity: 1;
    visibility: visible;
}

.camera-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.camera-header button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-header span {
    color: white;
    font-weight: 600;
    font-size: 16px;
}

#camera-preview {
    flex: 1;
    width: 100%;
    object-fit: cover;
}

.camera-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px 30px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
}

/* Gallery button (bottom left) */
.camera-gallery-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.4);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.camera-gallery-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.camera-gallery-btn:active {
    transform: scale(0.95);
}

/* Spacer for symmetry */
.camera-controls-spacer {
    width: 50px;
    height: 50px;
}

/* Capture hint text */
.camera-capture-hint {
    position: absolute;
    bottom: 130px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: opacity 0.2s ease;
}

/* Recording time display */
.recording-time {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    z-index: 15;
    animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Unified capture button with progress ring */
.camera-capture {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.camera-capture:hover {
    transform: scale(1.05);
}

.camera-capture:active {
    transform: scale(0.95);
}

/* Progress ring SVG */
.capture-progress-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.capture-progress-bg {
    fill: none;
    stroke: rgba(255,255,255,0.3);
    stroke-width: 4;
}

.capture-progress-ring {
    fill: none;
    stroke: #ef4444;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283; /* 2 * PI * 45 */
    stroke-dashoffset: 283;
    opacity: 0;
    transition: stroke-dashoffset 0.05s linear, opacity 0.2s ease;
}

/* Inner capture button */
.capture-inner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    border: 4px solid #1f2937;
    transition: all 0.2s ease;
}

/* Recording state - button turns red and shrinks to square */
.camera-capture.recording .capture-inner {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #ef4444;
    border-color: white;
}

.camera-capture.recording .capture-progress-ring {
    opacity: 1;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .story-creator-container {
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
    }

    .story-creator-header {
        padding: 14px 16px;
    }

    .story-creator-header h2 {
        font-size: 16px;
    }

    .story-creator-content {
        padding: 20px 16px;
    }

    .upload-options {
        gap: 12px;
    }

    .upload-option {
        padding: 20px 16px;
    }

    .upload-icon {
        width: 56px;
        height: 56px;
    }

    .upload-icon svg {
        width: 32px;
        height: 32px;
    }

    .preview-media {
        max-height: 300px;
    }

    .preview-media img,
    .preview-media video {
        max-height: 300px;
    }
}

@media (max-width: 400px) {
    .upload-options {
        flex-direction: column;
        align-items: center;
    }

    .upload-option {
        width: 100%;
        max-width: 100%;
        flex-direction: row;
        padding: 16px 20px;
        gap: 16px;
    }

    .upload-icon {
        width: 48px;
        height: 48px;
    }

    .upload-icon svg {
        width: 24px;
        height: 24px;
    }
}

/* Desktop fullscreen modal */
@media (min-width: 769px) {
    .story-creator-modal {
        align-items: center;
    }

    .story-creator-container {
        border-radius: 20px;
        max-height: 80vh;
    }
}
