/* Authentication Styles */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75); /* Darker premium overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeInOverlay 0.4s ease-out;
}

.auth-content {
    background: white;
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    will-change: transform, opacity;
    animation: popInModal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy premium intro */
}

.auth-logo-icon {
    background: #eff4ff;
    color: #4285f4;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 8px 16px rgba(66, 133, 244, 0.15);
}

.auth-content h3 {
    color: #1e293b;
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-content p {
    color: #64748b;
    margin: 0 0 30px 0;
    line-height: 1.6;
    font-size: 1rem;
}

.google-signin-btn {
    background: white;
    border: 1px solid #e2e8f0;
    color: #334155;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
}

.google-signin-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.google-signin-btn:active {
    background: #f1f5f9;
    transform: translateY(0);
}

.google-signin-btn img {
    align-self: center;
}

.auth-footer {
    margin-top: 25px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

/* New Premium Animations */
@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popInModal {
    0% { opacity: 0; transform: scale(0.9) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Subtle animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-profile {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    animation: slideInRight 0.5s ease-out;
    /* New Special Animation */
    transform: scale(0);
    animation: popInProfile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.4);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.profile-pic:hover {
    transform: scale(1.1);
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.6);
    border-color: var(--primary-color);
}

/* Special Pop-in Animation */
@keyframes popInProfile {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Profile Modal Styles */
.profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
    width: 90%;
    max-width: 350px;
    position: relative;
    border: 1px solid #e0e0e0;
    animation: slideInModal 0.3s ease-out;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background-color: #f5f5f5;
}

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

.modal-profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    margin: 0 auto;
    display: block;
}

.modal-body {
    text-align: center;
    margin-bottom: 25px;
}

.modal-user-name {
    color: var(--primary-color);
    margin: 15px 0 5px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-user-email {
    color: var(--light-text);
    font-size: 0.9rem;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: center;
}

.modal-signout-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.modal-signout-btn:hover {
    background: #c53030;
    transform: scale(1.05);
}

/* Modal Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInModal {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design for Auth */
@media (max-width: 768px) {
    .auth-container {
        padding: 20px;
    }

    .auth-content {
        padding: 25px 20px;
        width: 85%;
        max-width: 320px;
        border-radius: 20px;
        margin: 0 auto;
    }

    .auth-content h3 {
        font-size: 1.25rem;
    }

    .auth-content p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .google-signin-btn {
        padding: 12px 25px;
        font-size: 0.9rem;
    }

    .user-profile {
        top: 15px;
        right: 15px;
        padding: 15px;
    }

    .profile-pic {
        width: 35px;
        height: 35px;
    }

    .profile-info h3 {
        font-size: 1rem;
    }

    .signout-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .auth-content {
        padding: 20px 15px;
        width: 92%;
    }
    .auth-logo-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 15px;
    }
}

/* Terms of Service Section Styles */
.tos-section {
    margin: 15px 0 25px 0;
    text-align: left;
    background: #f8fafc;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.tos-summary {
    font-size: 0.9rem !important;
    color: #475569 !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.5 !important;
}

.learn-more-link {
    display: inline-block;
    font-size: 0.9rem;
    color: #4285f4;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 18px;
}

.learn-more-link:hover {
    text-decoration: underline;
}

.tos-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.tos-checkbox-label input {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4285f4;
}

.tos-checkbox-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
}

.tos-error-msg {
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 12px;
    display: none;
    background: #fef2f2;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #dc2626;
    animation: fadeIn 0.3s ease-in;
}

/* ==========================================================================
   New User Profile Setup Modal & YouTube-Style Circular Cropper
   ========================================================================== */

.profile-setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10005;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    padding: 16px;
    box-sizing: border-box;
}

.profile-setup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.profile-setup-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.35);
    transform: scale(0.92) translateY(15px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.profile-setup-overlay.active .profile-setup-card {
    transform: scale(1) translateY(0);
}

.profile-setup-header h2 {
    margin: 0 0 6px 0;
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.profile-setup-header p {
    margin: 0 0 24px 0;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.45;
}

.profile-setup-avatar-wrap {
    position: relative;
    width: 112px;
    height: 112px;
    margin: 0 auto 12px auto;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(66, 133, 244, 0.25);
    transition: transform 0.2s ease;
}

.profile-setup-avatar-wrap:hover {
    transform: scale(1.04);
}

.profile-setup-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 3.5px solid #ffffff;
    box-shadow: 0 0 0 2px #4285f4;
    background: #f1f5f9;
}

.profile-setup-camera-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 34px;
    height: 34px;
    background: #4285f4;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s, transform 0.2s;
}

.profile-setup-avatar-wrap:hover .profile-setup-camera-badge {
    background: #2563eb;
    transform: scale(1.1);
}

.profile-setup-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 22px;
}

.profile-setup-upload-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.profile-setup-field {
    text-align: left;
    margin-bottom: 20px;
}

.profile-setup-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 7px;
}

.profile-setup-input {
    width: 100%;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1.5px solid #cbd5e1;
    font-size: 1rem;
    color: #0f172a;
    background: #f8fafc;
    box-sizing: border-box;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.profile-setup-input:focus {
    border-color: #4285f4;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.15);
}

.profile-setup-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 6px 0 0 2px;
    line-height: 1.35;
}

.profile-setup-error {
    color: #ef4444;
    font-size: 0.84rem;
    font-weight: 500;
    margin: 8px 0;
    display: none;
}

.profile-setup-privacy-note {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 14px 0 18px 0;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.45;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    box-sizing: border-box;
}

.profile-setup-privacy-note svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #4285f4;
}

.profile-setup-privacy-note a {
    color: #4285f4;
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.profile-setup-privacy-note a:hover {
    color: #2563eb;
}

.profile-setup-save-btn {
    width: 100%;
    padding: 14px 20px;
    background: #4285f4;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1.02rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(66, 133, 244, 0.35);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    font-family: inherit;
}

.profile-setup-save-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(66, 133, 244, 0.45);
}

.profile-setup-save-btn:active {
    transform: translateY(0);
}

.profile-setup-save-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   YouTube-Style Circular Cropper Overlay
   ========================================================================== */

.crop-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 15px;
    box-sizing: border-box;
}

.crop-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.crop-modal-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    max-width: 440px;
    width: 100%;
    overflow: hidden;
    transform: scale(0.94);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.crop-modal-overlay.active .crop-modal-card {
    transform: scale(1);
}

.crop-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.crop-modal-header h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crop-modal-header p {
    margin: 3px 0 0 0;
    color: #64748b;
    font-size: 0.82rem;
}

.crop-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.crop-modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.crop-viewport-wrapper {
    position: relative;
    width: 100%;
    height: 310px;
    background: #0f172a;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
    cursor: grab;
}

.crop-viewport-wrapper:active {
    cursor: grabbing;
}

#cropCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.crop-controls-container {
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

.crop-zoom-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.crop-zoom-btn {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #334155;
    transition: all 0.2s;
    flex-shrink: 0;
}

.crop-zoom-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.crop-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 4px;
    background: #e2e8f0;
    outline: none;
    cursor: pointer;
}

.crop-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4285f4;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.4);
    transition: transform 0.1s;
}

.crop-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.crop-tool-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.crop-tool-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.crop-tool-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

.crop-footer {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    gap: 12px;
}

.crop-footer-btn-secondary {
    padding: 9px 16px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.crop-footer-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.crop-footer-btn-primary {
    padding: 9px 22px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.25);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.crop-footer-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.35);
}

.crop-footer-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 480px) {
    .profile-setup-card {
        padding: 24px 20px;
        border-radius: 20px;
    }
    .profile-setup-header h2 {
        font-size: 1.35rem;
    }
    .profile-setup-avatar-wrap {
        width: 100px;
        height: 100px;
    }
    .crop-viewport-wrapper {
        height: 260px;
    }
}