/* Auth Modal System for SparkSheets */

/* Overlay */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    animation: authFadeIn 0.2s ease-in;
    backdrop-filter: blur(4px);
}

.auth-modal-overlay.active {
    display: flex;
}

/* Modal Container */
.auth-modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: authSlideUp 0.3s ease-out;
    position: relative;
}

/* Close Button - Hidden */
.auth-modal-close {
    display: none;
}

.auth-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.auth-modal-close .material-icons {
    font-size: 20px;
}

/* Tab Navigation */
.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid #f0f0f0;
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 500;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.auth-tab:hover {
    color: #666;
}

.auth-tab.active {
    color: #4CAF50;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #4CAF50;
}

/* Form Containers */
.auth-form-container {
    display: none;
}

.auth-form-container.active {
    display: block;
    animation: authFadeIn 0.3s ease-out;
}

/* Form Groups */
.auth-form-container .form-group {
    margin-bottom: 20px;
}

.auth-form-container .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.auth-form-container .form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: #fafafa;
    box-sizing: border-box;
}

.auth-form-container .form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.auth-form-container .form-group input::placeholder {
    color: #aaa;
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #666;
}

.password-toggle .material-icons {
    font-size: 20px;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #666;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.forgot-password {
    color: #4CAF50;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.forgot-password:hover {
    color: #45a049;
    text-decoration: underline;
}

/* Terms Agreement */
.terms-agree {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #666;
}

.terms-agree input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.terms-agree a {
    color: #4CAF50;
    text-decoration: none;
}

.terms-agree a:hover {
    text-decoration: underline;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    background: #4CAF50;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-submit-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #999;
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.auth-divider span {
    padding: 0 16px;
}

/* Social Login */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.social-btn:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.social-btn .material-icons {
    font-size: 20px;
}

.social-btn.google-btn .material-icons {
    color: #4285F4;
}

.social-btn.github-btn .material-icons {
    color: #333;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e0e0e0;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 0%;
    transition: all 0.3s;
}

.strength-bar[data-strength="weak"]::after {
    width: 33%;
    background: #f44336;
}

.strength-bar[data-strength="medium"]::after {
    width: 66%;
    background: #ff9800;
}

.strength-bar[data-strength="strong"]::after {
    width: 100%;
    background: #4CAF50;
}

.strength-text {
    font-size: 12px;
    color: #999;
}

.strength-text[data-strength="weak"] {
    color: #f44336;
}

.strength-text[data-strength="medium"] {
    color: #ff9800;
}

.strength-text[data-strength="strong"] {
    color: #4CAF50;
}

/* Reset Password Form */
.reset-header {
    text-align: center;
    margin-bottom: 24px;
}

.reset-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

.reset-header p {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.back-to-login {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #4CAF50;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 20px;
    transition: color 0.2s;
}

.back-to-login:hover {
    color: #45a049;
}

.back-to-login .material-icons {
    font-size: 18px;
}

/* Auth Message */
.auth-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 16px;
    display: none;
}

.auth-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.auth-message.error {
    display: block;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.auth-message.info {
    display: block;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* Profile View */
.profile-container {
    animation: authFadeIn 0.3s ease-out;
}

.profile-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f0f0f0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.profile-avatar .material-icons {
    font-size: 48px;
    color: white;
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
}

.profile-email {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.profile-form {
    margin-bottom: 24px;
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form .form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.profile-form .form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s;
    background: #fafafa;
}

.profile-form .form-group input:focus {
    outline: none;
    border-color: #4CAF50;
    background: white;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.profile-form .form-group input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.form-text {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #999;
}

.profile-actions {
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.profile-logout-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid #f44336;
    border-radius: 8px;
    background: white;
    color: #f44336;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.profile-logout-btn:hover {
    background: #ffebee;
    border-color: #d32f2f;
    color: #d32f2f;
}

.profile-logout-btn .material-icons {
    font-size: 20px;
}

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

@keyframes authSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .auth-modal {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .auth-modal-close {
        background: #444;
        color: #aaa;
    }

    .auth-modal-close:hover {
        background: #555;
        color: #fff;
    }

    .auth-tabs {
        border-bottom-color: #444;
    }

    .auth-tab {
        color: #888;
    }

    .auth-tab:hover {
        color: #aaa;
    }

    .auth-tab.active {
        color: #4CAF50;
    }

    .auth-form-container .form-group label {
        color: #e0e0e0;
    }

    .auth-form-container .form-group input {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }

    .auth-form-container .form-group input:focus {
        background: #3d3d3d;
        border-color: #4CAF50;
    }

    .auth-form-container .form-group input::placeholder {
        color: #777;
    }

    .password-toggle {
        color: #888;
    }

    .password-toggle:hover {
        color: #aaa;
    }

    .remember-me,
    .terms-agree {
        color: #aaa;
    }

    .auth-divider {
        color: #777;
    }

    .auth-divider::before,
    .auth-divider::after {
        background: #444;
    }

    .social-btn {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }

    .social-btn:hover {
        background: #444;
        border-color: #666;
    }

    .strength-bar {
        background: #444;
    }

    .strength-text {
        color: #888;
    }

    .reset-header h3 {
        color: #e0e0e0;
    }

    .reset-header p {
        color: #aaa;
    }

    .auth-message.success {
        background: #1b5e20;
        color: #a5d6a7;
        border-color: #2e7d32;
    }

    .auth-message.error {
        background: #b71c1c;
        color: #ffcdd2;
        border-color: #c62828;
    }

    .auth-message.info {
        background: #0d47a1;
        color: #bbdefb;
        border-color: #1565c0;
    }

    /* Profile View - Dark Mode */
    .profile-header {
        border-bottom-color: #444;
    }

    .profile-name {
        color: #e0e0e0;
    }

    .profile-email {
        color: #aaa;
    }

    .profile-form .form-group label {
        color: #e0e0e0;
    }

    .profile-form .form-group input {
        background: #3d3d3d;
        border-color: #555;
        color: #e0e0e0;
    }

    .profile-form .form-group input:focus {
        background: #3d3d3d;
        border-color: #4CAF50;
    }

    .profile-form .form-group input:disabled {
        background: #2d2d2d;
        color: #777;
    }

    .form-text {
        color: #777;
    }

    .profile-actions {
        border-top-color: #444;
    }

    .profile-logout-btn {
        background: #3d3d3d;
        border-color: #f44336;
        color: #ff6659;
    }

    .profile-logout-btn:hover {
        background: #4d2c2c;
        border-color: #ff6659;
        color: #ff8a80;
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .auth-modal {
        padding: 24px;
        margin: 16px;
        border-radius: 12px;
    }

    .auth-tab {
        padding: 10px 12px;
        font-size: 14px;
    }

    .auth-form-container .form-group input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .auth-submit-btn {
        padding: 12px;
        font-size: 14px;
    }

    .social-btn {
        padding: 10px;
        font-size: 13px;
    }
}
