* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 30px 15px;
    display: flex;
    align-items: stretch;
}

.container {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.header-icon svg {
    color: white;
}

.header-text h1 {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 4px 0;
    letter-spacing: -0.5px;
}

.header-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    margin: 0;
    font-weight: 400;
}

.view-albums-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.view-albums-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 表單區域 */
.form-section {
    padding: 30px;
    background: #fafbfc;
}

.input-group {
    margin-bottom: 24px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    font-size: 15px;
}

.input-group label svg {
    color: #667eea;
}

.input-with-voice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.input-with-voice input,
.input-with-voice textarea {
    flex: 1;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    transition: all 0.3s;
    background: white;
}

.input-with-voice input:focus,
.input-with-voice textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.input-with-voice textarea {
    resize: vertical;
    min-height: 100px;
}

/* 語音按鈕 */
.voice-btn {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.voice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.voice-btn:active {
    transform: translateY(0);
}

.voice-btn.listening {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
    }
}

/* 拍照區域 */
.camera-section {
    text-align: center;
    margin: 30px 0;
}

.big-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.big-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.big-btn:active {
    transform: translateY(0);
}

.camera-btn {
    background: #2c5aa0;
    color: white;
    margin-bottom: 15px;
}

.camera-btn:hover {
    background: #234a87;
}

.upload-btn {
    background: #059669;
    color: white;
}

.upload-btn:hover {
    background: #047857;
}

.upload-btn:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.photo-count {
    font-size: 15px;
    color: #6b7280;
    font-weight: 500;
}

.photo-count span {
    color: #2c5aa0;
    font-size: 18px;
    font-weight: 600;
}

/* 照片預覽 */
.photo-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    padding: 30px;
    background: white;
    min-height: 100px;
    flex: 1;
    align-content: start;
}

.photo-preview:empty {
    display: flex;
}

.photo-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid #f3f4f6;
    transition: all 0.3s;
    animation: photoAppear 0.4s ease;
}

@keyframes photoAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.photo-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.delete-photo {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.delete-photo:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
}

.delete-photo:active {
    transform: scale(0.95);
}

/* 狀態訊息 */
.status-message {
    margin: 20px 30px;
    padding: 16px 20px;
    border-radius: 12px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    display: none;
    border-left: 5px solid;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message.show {
    display: block;
}

.status-message.success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.status-message.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.status-message.info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* 照片計數區域 */
.photo-count-section {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.photo-count-section svg {
    color: white;
}

.photo-count-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.photo-count-badge {
    background: white;
    color: #667eea;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    animation: countBadge 0.5s ease;
}

@keyframes countBadge {
    0% {
        transform: scale(0.8);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* 固定浮動按鈕 */
.floating-buttons {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 1000;
}

.floating-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.floating-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.floating-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.floating-btn svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* 拍照按鈕 */
.camera-floating-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    animation: cameraFloat 3s ease-in-out infinite;
    width: 144px;
    height: 144px;
}

.camera-floating-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.camera-floating-btn svg {
    width: 96px;
    height: 96px;
}

/* 拍照按鈕動畫效果 */
@keyframes cameraFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-5px) rotate(-2deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(-3px) rotate(2deg);
    }
}

@keyframes cameraPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 0 0 15px rgba(59, 130, 246, 0);
    }
}

.camera-floating-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent);
    animation: cameraPulse 2s ease-in-out infinite;
}

/* 上傳按鈕 */
.upload-floating-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.upload-floating-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.upload-floating-btn:disabled {
    background: linear-gradient(135deg, #d1d5db 0%, #9ca3af 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.upload-floating-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 按鈕提示 */
.floating-btn::after {
    content: attr(title);
    position: absolute;
    right: 75px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.floating-btn:hover::after {
    opacity: 1;
}

/* 上傳過場動畫 */
.upload-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.upload-overlay.show {
    display: flex;
}

.upload-spinner-container {
    text-align: center;
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.upload-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.upload-progress {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    margin-top: 10px;
}

/* 新增：上傳結果圖示 */
.overlay-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    animation: icon-pulse 0.5s ease-in-out;
}

@keyframes icon-pulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.overlay-icon.success {
    border-radius: 50%;
    border: 4px solid #34d399;
    color: #34d399;
}

.overlay-icon.error {
    border-radius: 50%;
    border: 4px solid #f87171;
    color: #f87171;
}

/* 確保 SweetAlert2 彈窗層級高於自訂 modal */
.swal2-container {
    z-index: 20000 !important;
}

/* 供手機開啟相機/相簿時暫時隱藏補傳 modal 內容 */
.modal-content-hidden {
    display: none !important;
}

/* 行動裝置優化 */
@media (max-width: 480px) {
    body {
        padding: 20px 10px;
    }

    .container {
        border-radius: 12px;
        min-height: calc(100vh - 40px);
    }

    header {
        padding: 20px;
    }

    .header-content {
        width: 100%;
        margin-bottom: 12px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .header-icon {
        width: 48px;
        height: 48px;
    }

    .header-icon svg {
        width: 28px;
        height: 28px;
    }

    .header-text h1 {
        font-size: 20px;
    }

    .header-subtitle {
        font-size: 13px;
    }

    .view-albums-btn {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .photo-count-section {
        padding: 6px 12px;
        gap: 5px;
    }

    .photo-count-section svg {
        width: 16px;
        height: 16px;
    }

    .photo-count-text {
        font-size: 13px;
    }

    .photo-count-badge {
        padding: 3px 10px;
        font-size: 14px;
    }

    .form-section {
        padding: 20px;
    }

    .input-group {
        margin-bottom: 20px;
    }

    .input-group label {
        font-size: 14px;
    }

    .input-with-voice input,
    .input-with-voice textarea {
        padding: 12px 14px;
        font-size: 14px;
    }

    .photo-count-section {
        padding: 16px 20px;
        gap: 8px;
    }

    .photo-count-text {
        font-size: 14px;
    }

    .photo-count-badge {
        padding: 5px 14px;
        font-size: 16px;
    }

    .photo-preview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
        padding: 20px;
    }

    .photo-item img {
        height: 120px;
    }

    .status-message {
        margin: 15px 20px;
        padding: 14px 16px;
        font-size: 14px;
    }

    .floating-buttons {
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        gap: 12px;
    }

    .floating-btn {
        width: 56px;
        height: 56px;
    }

    .floating-btn svg {
        width: 24px;
        height: 24px;
    }

    .camera-floating-btn {
        width: 128px;
        height: 128px;
    }

    .camera-floating-btn svg {
        width: 80px;
        height: 80px;
    }

    .upload-spinner-container {
        padding: 30px 40px;
    }

    .floating-btn::after {
        display: none;
    }
}
