/* Modernized signup page styling: mirrors Cognito's clean, card-based design with customizable buttons. */

/* CSS Custom Properties for Theming */
:root {
    --primary-color: #6600ee;
    --primary-hover: #d3c8ff;
    --neutral-color: #6c757d;
    --neutral-hover: #adb5bd;
    --background-color: white;
    --text-color: black;
    --border-color: #e6e6e6;
    --input-background: #f5f5ff;
    --card-background: #ffffff;
    --hover-color: #f0eaff;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.12);
}

body.dark {
    --background-color: #1e1e1e;
    --text-color: #e0e0e0;
    --border-color: #444;
    --input-background: #2a2a2a;
    --card-background: #2a2a2a;
    --hover-color: #3a3a3a;
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.3);
}

* {
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    background: linear-gradient(to bottom, var(--background-color), var(--input-background));
    overflow-x: hidden;
    font-family: 'Global Sans Serif', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--input-background);
}

/* Header Styling */
header {
    background-color: transparent;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

body.dark header {
    background-color: #333;
    border-bottom: 1px solid #555;
}

.rfiler-logo {
    width: 15vw;
    max-width: 187px;
    height: auto;
}

/* Sign-in link */
.sign-in-link {
    position: absolute;
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 500;
    color: black;
    font-size: 1.2rem;
    text-decoration: none;
    right: 2rem;
    top: 2rem;
}

body.dark .sign-in-link {
    color: #e0e0e0;
}

.sign-in-link:hover {
    color: #6600ee;
}

body.dark .sign-in-link:hover {
    color: #a78bfa;
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    z-index: 99;
    transition: background 0.3s, border-color 0.3s;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.04);
}

body.dark footer {
    background: var(--background-color);
    border-top-color: var(--border-color);
}

/* Action Buttons Container */
.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Contact Us and Need Help Icons */
.help-icon {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 0.35rem 0.7rem !important;
    width: auto !important;
    height: 28px !important;
    min-width: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    box-shadow: var(--shadow-light) !important;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    white-space: nowrap !important;
    font-family: 'Global Sans Serif', sans-serif !important;
    line-height: 1 !important;
    text-decoration: none !important;
}

.help-icon i {
    font-size: 0.7rem !important;
    display: inline-flex !important;
    align-items: center !important;
}

.help-icon span {
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    display: inline-block !important;
}

.contact-us-icon {
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 0.35rem 0.7rem !important;
    height: 28px !important;
    min-width: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    box-shadow: var(--shadow-light) !important;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    white-space: nowrap !important;
    font-family: 'Global Sans Serif', sans-serif !important;
    line-height: 1 !important;
}

.help-icon i,
.contact-us-icon i {
    font-size: 0.7rem !important;
    display: inline-flex !important;
    align-items: center !important;
}

.help-icon span,
.contact-us-icon span {
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    display: inline-block !important;
}

.help-icon:hover {
    background: var(--primary-hover) !important;
    color: black !important;
    transform: scale(1.05) !important;
    box-shadow: var(--shadow-hover) !important;
}

.contact-us-icon:hover {
    background: var(--primary-hover) !important;
    color: black !important;
    transform: scale(1.05) !important;
    box-shadow: var(--shadow-hover) !important;
}

body.dark .help-icon {
    background: #a78bfa !important;
}

body.dark .contact-us-icon {
    background: #a78bfa !important;
}

body.dark .help-icon:hover {
    background: #d3c8ff !important;
}

body.dark .contact-us-icon:hover {
    background: #d3c8ff !important;
}

.help-text, .contact-text {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    margin: 0;
    color: black;
    align-self: center;
}

/* Main layout */
.signup-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 45px);
    padding: 100px 1rem 1rem;
    gap: 1.5rem;
    width: 100%;
}

/* Signup container - two column layout */
.signup-container {
    display: flex;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    align-items: flex-start;
    justify-content: center;
}

/* Signup section */
.signup-section {
    background: var(--card-background);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    transition: box-shadow 0.3s ease;
    text-align: center;
    flex: 0 1 auto;
}

/* Info panel */
.info-panel {
    background: var(--card-background);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    transition: box-shadow 0.3s ease;
    flex: 1 1 auto;
    align-self: center;
}

.info-panel:hover {
    box-shadow: var(--shadow-hover);
}

.info-panel-content {
    display: flex;
    flex-direction: column;
}

.info-panel-content h2 {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

/* Stepper Styles */
.stepper {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.stepper-step {
    display: flex;
    gap: 1.5rem;
    position: relative;
    padding-bottom: 2rem;
}

.stepper-step:last-child {
    padding-bottom: 0;
}

.success-message {
    margin: 1rem 0 1.5rem 0;
    margin-left: 4rem;
    padding: 1rem 1.25rem;
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-radius: 8px;
    text-align: left;
    position: relative;
}

.success-message p {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.95rem;
    color: #155724;
    margin: 0;
    font-weight: 500;
    line-height: 1.5;
}

body.dark .success-message {
    background: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.4);
}

body.dark .success-message p {
    color: #81c784;
}

/* Responsive: align success message on mobile */
@media (max-width: 768px) {
    .success-message {
        margin-left: 0;
        text-align: center;
    }
}

.stepper-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 1.25rem;
    top: 3rem;
    width: 2px;
    height: calc(100% - 1rem);
    background: var(--border-color);
    z-index: 0;
}

.stepper-step.completed:not(:last-child)::after {
    background: var(--primary-color);
}

.stepper-number {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--input-background);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.stepper-step.active .stepper-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.stepper-step.completed .stepper-number {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.stepper-content {
    flex: 1;
    padding-top: 0.25rem;
}

.stepper-title {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
}

.stepper-step.active .stepper-title {
    color: var(--primary-color);
}

.stepper-text {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.95rem;
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

.stepper-note {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.9rem;
    color: var(--neutral-color);
    margin: 0.5rem 0 0 0;
    font-style: italic;
    line-height: 1.5;
}

body.dark .stepper-note {
    color: var(--neutral-hover);
}

#user-email-display {
    font-weight: 600;
    color: var(--primary-color);
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.step-title {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
}

.step-text {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 1rem;
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
}

.resend-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.stepper-step .resend-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.resend-text {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.95rem;
    color: var(--text-color);
    margin: 0;
}

.resend-link {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    cursor: pointer;
}

.resend-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

body.dark .resend-link {
    color: #a78bfa;
}

body.dark .resend-link:hover {
    color: #d3c8ff;
}

.signup-section:hover {
    box-shadow: var(--shadow-hover);
}

.form-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1.5rem;
}

.signup-section h2 {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

/* Signup Form */
.signup-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.form-group label {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.95rem;
    background: var(--input-background);
    color: var(--text-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 0, 238, 0.1);
}

.form-group input::placeholder {
    color: var(--neutral-color);
}

body.dark .form-group input::placeholder {
    color: var(--neutral-hover);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: var(--primary-color);
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.eula-link {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1rem;
}

.eula-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

body.dark .eula-link {
    color: #a78bfa;
}

body.dark .eula-link:hover {
    color: #d3c8ff;
}

/* Buttons */
.save-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.save-btn:disabled {
    background-color: var(--neutral-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.save-btn:hover:not(.loading):not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.save-btn.loading {
    background-color: var(--neutral-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.save-btn.loading i.fa-user-plus,
.save-btn.loading span {
    visibility: hidden;
}

.save-btn.loading::before {
    content: "\f110";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 1rem;
    color: white;
    animation: spin 1s linear infinite;
    position: absolute;
    visibility: visible;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Links */
.form-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.back-link {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 500;
    color: var(--primary-color);
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

body.dark .back-link {
    color: #a78bfa;
}

body.dark .back-link:hover {
    color: #d3c8ff;
}

/* Popup */
.group-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in-out;
}

.group-popup[style*="display: flex"] {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup-content {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-light);
    animation: slideIn 0.3s ease-in-out;
    position: relative;
}

.eula-popup-content,
.explain-popup-content {
    max-width: 600px;
    padding: 2rem;
}

.contact-us-popup .popup-content {
    max-width: 600px;
}

.explain-content {
    font-family: 'Global Sans Serif', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
}

.explain-content p {
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.explain-step {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--input-background);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.explain-step h3 {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 0 0 0.5rem 0;
}

.explain-step p {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.95rem;
    color: var(--text-color);
    margin: 0.5rem 0;
}

.explain-step strong {
    color: var(--primary-color);
    font-weight: 600;
}

.explain-tip {
    margin: 1.5rem 0 0 0;
    padding: 1rem;
    background: rgba(102, 0, 238, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.explain-tip p {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 0.95rem;
    color: var(--text-color);
    margin: 0;
}

.explain-tip strong {
    color: var(--primary-color);
    font-weight: 600;
}

body.dark .explain-step {
    background: var(--hover-color);
}

body.dark .explain-tip {
    background: rgba(167, 139, 250, 0.2);
}

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

.popup-content h2 {
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 600;
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.popup-content .message-text {
    font-family: 'Global Sans Serif', sans-serif;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #333;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10;
    padding: 4px;
    line-height: 1;
}

body.dark .close-btn {
    color: #e0e0e0;
}

.close-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.close-btn i {
    display: block;
    visibility: visible;
}

.close-eula-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: 'Global Sans Serif', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    background-color: var(--primary-color);
    color: white;
    margin-top: 1rem;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.close-eula-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

body.dark .close-eula-btn {
    background-color: #a78bfa;
}

body.dark .close-eula-btn:hover {
    background-color: #d3c8ff;
}

.group-popup.success .popup-content {
    border: 1px solid #28a745;
}

.group-popup.error .popup-content {
    border: 1px solid #dc3545;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .signup-container {
        padding: 0 1rem;
    }
    
    .signup-section {
        max-width: 350px;
    }
    
    .info-panel {
        max-width: 450px;
    }
}

@media (max-width: 900px) {
    .signup-container {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    
    .signup-section {
        max-width: 500px;
        width: 100%;
    }
    
    .info-panel {
        max-width: 500px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .signup-page {
        padding: 80px 0.5rem 1rem;
    }

    .signup-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 0 0.5rem;
    }

    .signup-section {
        padding: 1rem;
        max-width: 100%;
    }

    .info-panel {
        padding: 1rem;
        max-width: 100%;
    }

    .form-logo {
        width: 100px;
    }

    .save-btn {
        padding: 0.75rem;
    }

    .nav-links a {
        margin: 0 10px;
        font-size: 0.9rem;
    }

    .popup-content {
        width: 90%;
        padding: 1rem;
    }

    .eula-popup-content {
        max-width: 90%;
        padding: 1rem;
    }

    .close-btn {
        top: 8px;
        right: 8px;
        font-size: 1.1rem;
    }

    .eula-popup-content iframe {
        height: 50vh;
    }
}