/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Main Panel Container */
.email-panel {
    max-width: 600px;
    width: 100%;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 4px 20px var(--shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

/* Header Section */
.email-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.email-panel__title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.language-toggle:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.language-toggle:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.language-toggle__icon {
    font-size: 16px;
}

/* Form Section */
.email-panel__form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.input-group {
    position: relative;
    width: 100%;
}

.email-panel__input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.2s ease;
}

.email-panel__input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.email-panel__input:invalid:not(:placeholder-shown) {
    border-color: var(--error);
}

.email-panel__input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.email-panel__button {
    height: 48px;
    min-width: 100px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.email-panel__button--primary {
    background-color: var(--accent-primary);
    color: white;
    padding: 0 32px;
}

.email-panel__button--primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.email-panel__button--primary:active:not(:disabled) {
    transform: translateY(0);
}

.email-panel__button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.email-panel__button:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Status Messages */
.status-container {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-message {
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    display: none;
    max-width: 100%;
}

.status-message.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
    display: block;
}

.status-message.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
    display: block;
}

.status-message.info {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    display: block;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.loading-spinner.show {
    display: flex;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Footer Section */
.email-panel__footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.theme-toggle:hover {
    background-color: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.theme-toggle:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.theme-toggle__icon {
    font-size: 16px;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .theme-toggle__icon {
    transform: rotate(180deg);
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.input-help {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Focus indicators for keyboard navigation */
*:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

button:focus, input:focus {
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .email-panel {
        border: 2px solid var(--text-primary);
    }
    
    .email-panel__input, .language-toggle, .theme-toggle {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
        border-top-color: var(--accent-primary);
    }
}
