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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    border-radius: 16px;
    color: white;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 30px;
}

.quick-cite {
    max-width: 700px;
    margin: 0 auto;
}

.quick-cite-input {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.quick-cite-input input {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.quick-cite-input input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.btn-quick {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background-color: white;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-quick:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2);
}

.quick-cite-help {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
}

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.cite-methods {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: -10px;
}

.method-tab {
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: 8px 8px 0 0;
    background-color: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.method-tab:hover {
    background-color: var(--surface);
    border-color: var(--primary-color);
}

.method-tab.active {
    background-color: var(--surface);
    color: var(--primary-color);
    border-color: var(--primary-color);
    border-bottom-color: var(--surface);
    position: relative;
    bottom: -2px;
}

.form-section {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.main-label {
    display: block;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.source-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.source-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.source-select:hover {
    border-color: var(--primary-color);
}

.citation-form {
    margin-top: 30px;
    animation: fadeIn 0.3s ease-in;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group label .required {
    color: #ef4444;
    margin-left: 2px;
}

.form-group label .help-text {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 2px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group input[type="date"] {
    cursor: pointer;
}

.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    background-color: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--background);
    border-color: var(--secondary-color);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.output-section {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease-in;
}

.output-section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.citation-output {
    background-color: var(--background);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 20px;
    font-family: 'Georgia', serif;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.citation-output em {
    font-style: italic;
}

.output-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.citation-list {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.list-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.list-actions {
    display: flex;
    gap: 8px;
}

.saved-citations {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.saved-citation-item {
    background-color: var(--background);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--success-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.saved-citation-text {
    flex: 1;
    font-family: 'Georgia', serif;
    line-height: 1.8;
    color: var(--text-primary);
}

.saved-citation-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 0.875rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.btn-icon:hover {
    background-color: var(--background);
    color: var(--text-primary);
    border-color: var(--secondary-color);
}

.help-section {
    background: var(--surface);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 30px;
}

.help-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.help-item {
    padding: 20px;
    background-color: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.help-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.help-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.help-item h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.help-item p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.help-tips {
    padding: 20px;
    background-color: var(--background);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.help-tips h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.help-section li:last-child {
    border-bottom: none;
}

.help-section strong {
    color: var(--text-primary);
}

footer {
    margin-top: 40px;
    padding-bottom: 40px;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--success-color);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
}

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

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .quick-cite-input {
        flex-direction: column;
    }

    .btn-quick {
        width: 100%;
        justify-content: center;
    }

    .cite-methods {
        flex-direction: column;
    }

    .method-tab {
        border-radius: 8px;
        width: 100%;
    }

    .method-tab.active {
        bottom: 0;
    }

    .help-grid {
        grid-template-columns: 1fr;
    }

    .form-section,
    .output-section,
    .citation-list,
    .help-section {
        padding: 20px;
    }

    .form-buttons,
    .output-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .saved-citation-item {
        flex-direction: column;
    }

    .saved-citation-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
