:root {
    --primary-color: #6366f1;
    --primary-dark: #4338ca;
    --secondary-color: #64748b;
    --accent-color: #a78bfa;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --border-radius: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px 0 rgba(0,0,0,0.25);
    --transition: 0.3s cubic-bezier(.4,2,.6,1);
    --font-main: 'Inter', 'Segoe UI', Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    background: #181a20;
    color: #f3f4f6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: transparent;
}

.app-header {
    background: linear-gradient(135deg, #23263a 60%, var(--primary-dark) 100%);
    color: #fff;
    padding: 2.5rem 2rem 2rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 0.5rem;
}

.logo i {
    font-size: 2.5rem;
    color: var(--accent-color);
    filter: drop-shadow(0 2px 8px #a78bfa44);
}

.logo h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.15rem;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}

#mode-toggle {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: #23263a;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    box-shadow: 0 2px 8px #0002;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#mode-toggle:hover {
    background: var(--primary-color);
    color: #fff;
    transform: scale(1.08);
}

.container {
    max-width: 700px;
    min-width: 320px;
    margin: 2.5rem auto 1.5rem auto;
    padding: 0 2rem;
    flex: 1;
}

.form-section {
    background: #23263a;
    padding: 2.5rem 2rem 2rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    transition: background var(--transition), box-shadow var(--transition);
}

.form-section:hover {
    box-shadow: 0 12px 40px 0 #0005;
}

.form-group {
    margin-bottom: 1.7rem;
}

label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #e0e7ef;
    font-size: 1.08rem;
}

label i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

input, textarea {
    width: 100%;
    padding: 1.15rem 1.1rem;
    border: 2px solid #35384a;
    border-radius: 12px;
    font-size: 1.08rem;
    background: #181a20;
    color: #f3f4f6;
    transition: border var(--transition), background var(--transition), color var(--transition);
    box-shadow: 0 2px 8px #0001;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #23263a;
}

small {
    display: block;
    margin-top: 0.25rem;
    color: #a1a1aa;
    font-size: 0.93rem;
}

.primary-button {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: #fff;
    padding: 1.15rem 2rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.13rem;
    font-weight: 700;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    box-shadow: 0 4px 16px #6366f155;
    margin-top: 0.5rem;
    transition: background var(--transition), box-shadow var(--transition), transform 0.18s;
}

.primary-button:hover {
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 32px #6366f188;
}

.primary-button:active {
    transform: scale(0.98);
}

.hidden {
    display: none;
}

.loading-container {
    text-align: center;
    padding: 3rem 1rem;
    background: #23263a;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 54px;
    height: 54px;
    border: 5px solid #35384a;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1.2rem auto;
    animation: spin 1s linear infinite;
}

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

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.output-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.version-selector {
    display: flex;
    gap: 0.5rem;
}

.version-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--primary-color);
    background: #181a20;
    color: var(--primary-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: background var(--transition), color var(--transition), border var(--transition);
}

.version-btn.active, .version-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--accent-color);
}

.output-container {
    background: #23263a;
    padding: 2rem 1.2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

#coverOutput {
    width: 100%;
    min-height: 400px;
    margin-bottom: 1.5rem;
    padding: 1.1rem;
    border: 2px solid #35384a;
    border-radius: 12px;
    font-size: 1.08rem;
    line-height: 1.8;
    background: #181a20;
    color: #f3f4f6;
    resize: vertical;
    transition: border var(--transition), background var(--transition), color var(--transition);
}

.button-group {
    display: flex;
    gap: 1.2rem;
    justify-content: center;
}

.action-button {
    flex: 1;
    max-width: 220px;
    padding: 1rem 1.2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.08rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    background: #181a20;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: 0 2px 8px #6366f122;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform 0.18s;
}

.action-button:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 32px #6366f188;
}

.app-footer {
    background: #23263a;
    padding: 1.5rem 1rem;
    text-align: center;
    margin-top: auto;
    box-shadow: var(--shadow-lg);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.copyright {
    color: #a1a1aa;
    font-size: 0.93rem;
    margin-top: 0.5rem;
}

/* Light mode styles */
body.light-mode {
    background: #f3f4f6;
    color: #23263a;
}

body.light-mode .app-header {
    background: linear-gradient(135deg, #fff 60%, var(--primary-color) 100%);
    color: #23263a;
}

body.light-mode .logo i {
    color: var(--primary-color);
    filter: none;
}

body.light-mode .form-section,
body.light-mode .output-container,
body.light-mode .loading-container {
    background: #fff;
    box-shadow: 0 4px 24px #6366f122;
}

body.light-mode label {
    color: #23263a;
}

body.light-mode input,
body.light-mode textarea,
body.light-mode #coverOutput {
    background: #f3f4f6;
    color: #23263a;
    border: 2px solid #e5e7eb;
}

body.light-mode input:focus,
body.light-mode textarea:focus,
body.light-mode #coverOutput:focus {
    background: #fff;
    border-color: var(--primary-color);
}

body.light-mode .primary-button {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    color: #fff;
}

body.light-mode .primary-button:hover {
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
}

body.light-mode .version-btn {
    background: #f3f4f6;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

body.light-mode .version-btn.active, body.light-mode .version-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--accent-color);
}

body.light-mode .action-button {
    background: #f3f4f6;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

body.light-mode .action-button:hover {
    background: var(--primary-color);
    color: #fff;
}

body.light-mode .app-footer {
    background: #fff;
    color: #23263a;
    box-shadow: 0 4px 24px #6366f122;
}

@media (max-width: 900px) {
    .container {
        max-width: 98vw;
        padding: 0 1rem;
    }
}

@media (max-width: 600px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.3rem;
        min-width: 0;
    }
    .form-section {
        padding: 1.2rem 0.7rem;
    }
    .output-container {
        padding: 1.2rem 0.7rem;
    }
    .output-header {
        flex-direction: column;
        gap: 1rem;
    }
    .button-group {
        flex-direction: column;
        gap: 0.7rem;
    }
    .action-button {
        max-width: 100%;
    }
    #coverOutput {
        min-height: 250px;
    }
}

.form-group textarea#jobDescription {
    min-height: 100px;
    resize: vertical;
}

.form-group select#language {
    width: 100%;
    padding: 1.1rem;
    border: 2px solid #35384a;
    border-radius: 12px;
    font-size: 1.08rem;
    background: #181a20;
    color: #f3f4f6;
    transition: border var(--transition), background var(--transition), color var(--transition);
    box-shadow: 0 2px 8px #0001;
}
body.light-mode .form-group select#language {
    background: #f3f4f6;
    color: #23263a;
    border: 2px solid #e5e7eb;
}

.output-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    justify-content: flex-end;
}
.tab-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 10px 10px 0 0;
    background: #23263a;
    color: #a1a1aa;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    border-bottom: 2px solid transparent;
}
.tab-btn.active, .tab-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-bottom: 2px solid var(--accent-color);
}
body.light-mode .tab-btn {
    background: #f3f4f6;
    color: #23263a;
}
body.light-mode .tab-btn.active, body.light-mode .tab-btn:hover {
    background: var(--primary-color);
    color: #fff;
}
.output-tab-content {
    display: none;
}
.output-tab-content:not(.hidden) {
    display: block;
}
.cover-preview {
    background: #181a20;
    color: #f3f4f6;
    border-radius: 12px;
    padding: 2rem 1.2rem;
    min-height: 400px;
    font-size: 1.13rem;
    line-height: 2;
    box-shadow: 0 2px 8px #0002;
    font-family: 'Georgia', 'Times New Roman', serif;
    white-space: pre-line;
}
body.light-mode .cover-preview {
    background: #fff;
    color: #23263a;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(24,26,32,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.modal-content {
    background: #23263a;
    color: #fff;
    padding: 2rem 2.5rem 1.5rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px #0008;
    min-width: 320px;
    max-width: 95vw;
    position: relative;
    text-align: center;
}
body.light-mode .modal-content {
    background: #fff;
    color: #23263a;
}
.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: #a1a1aa;
    cursor: pointer;
    transition: color 0.2s;
}
.close-modal:hover {
    color: var(--primary-color);
}
#emailAddress {
    width: 100%;
    padding: 1rem;
    margin: 1rem 0 1.5rem 0;
    border: 2px solid #35384a;
    border-radius: 12px;
    font-size: 1.08rem;
    background: #181a20;
    color: #f3f4f6;
    transition: border var(--transition), background var(--transition), color var(--transition);
}
body.light-mode #emailAddress {
    background: #f3f4f6;
    color: #23263a;
    border: 2px solid #e5e7eb;
}

/* History Styles */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-height: 400px;
    overflow-y: auto;
}
.history-item {
    background: #23263a;
    color: #f3f4f6;
    border-radius: 10px;
    padding: 1.2rem 1rem;
    box-shadow: 0 2px 8px #0002;
    position: relative;
    transition: background 0.2s;
}
body.light-mode .history-item {
    background: #fff;
    color: #23263a;
}
.history-item .history-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}
.history-actions button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}
.history-actions button:hover {
    background: var(--accent-color);
}
.history-item .history-date {
    font-size: 0.9rem;
    color: #a1a1aa;
    margin-bottom: 0.5rem;
}
@media (max-width: 600px) {
    .cover-preview {
        min-height: 200px;
        padding: 1rem 0.5rem;
    }
    .modal-content {
        padding: 1.2rem 0.7rem 1rem 0.7rem;
        min-width: 0;
    }
    .history-list {
        max-height: 200px;
    }
} 