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

:root{
    --bg-1: #f6f8fb;
    --accent-1: #667eea;
    --accent-2: #764ba2;
    --muted: #6b7280;
    --card: #ffffff;
    --glass: rgba(255,255,255,0.7);
    --radius: 12px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    background: radial-gradient(1200px 400px at 10% 10%, rgba(102,126,234,0.12), transparent 8%),
                radial-gradient(1000px 300px at 90% 90%, rgba(118,75,162,0.08), transparent 8%),
                var(--bg-1);
    min-height: 100vh;
    padding: 28px;
    color: #111827;
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
}

/* Decorative background: static professional gradient */
.bg-dots{ display:none; }

/* Hero styles */
.hero-inner{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 24px;
}
.hero-copy{
    flex: 1 1 52%;
    z-index: 2;
}
.hero-illustration{
    flex: 0 0 42%;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index: 2;
}
.hero-illustration svg{ width:100%; max-width:320px; height:auto; filter: drop-shadow(0 10px 30px rgba(2,6,23,0.12)); }
.header-subtitle{ font-size:1.05rem; color:var(--muted); margin-top:10px; }

/* Ensure main container contents are above bg */
.container{ position: relative; z-index: 3; }

.container {
    max-width: 1400px;
    width: calc(100% - 48px);
    margin: 12px auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(2,6,23,0.06);
    overflow: visible;
}

/* topbar (compact) */
.topbar{
    background: transparent;
    border-bottom: 1px solid rgba(15,23,42,0.04);
}

.topbar .brand h2{ color: #0f172a; font-weight:700; }
.topbar .nav-link{ color: var(--muted); font-weight:600; }

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Navigation Bar */
.nav-bar {
    background: transparent;
    padding: 14px 28px;
    border-bottom: 1px solid rgba(15,23,42,0.05);
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--accent-1);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s, transform 0.15s;
}

.nav-link:hover {
    color: #764ba2;
}

main {
    padding: 28px 32px;
}

/* Profile Selector Section */
.profile-selector-section {
    background: #fbfbfc;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-selector-section label {
    font-weight: 600;
    color: #333;
}

.profile-selector-section select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
    min-width: 250px;
    background: white;
    cursor: pointer;
}

.profile-selector-section select:focus {
    outline: none;
    border-color: #667eea;
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 26px;
}

@media (max-width: 900px) {
    .input-section {
        grid-template-columns: 1fr;
    }
    
    .profile-selector-section {
        flex-direction: column;
        align-items: stretch;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 1.05em;
}

.form-group textarea,
.form-group input {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s;
}

.form-group textarea:focus,
.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.form-group small {
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    color: white;
    box-shadow: 0 8px 20px rgba(102,126,234,0.18);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #fff;
    color: #111827;
    border: 1px solid rgba(15,23,42,0.06);
    box-shadow: 0 4px 14px rgba(2,6,23,0.04);
}

.btn-secondary:hover {
    background: #e8e8e8;
    border-color: #667eea;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9em;
}

.loading {
    text-align: center;
    padding: 40px;
    margin: 20px 0;
}

.spinner {
    border: 4px solid #f0f0f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading p {
    color: #667eea;
    font-weight: 600;
}

.error {
    background: #fee;
    border: 2px solid #f88;
    border-radius: 8px;
    padding: 15px;
    color: #c00;
    margin-bottom: 20px;
}

.success {
    background: #efe;
    border: 2px solid #8f8;
    border-radius: 8px;
    padding: 15px;
    color: #080;
    margin-bottom: 20px;
}

.output-section {
    margin-top: 40px;
    border-top: 2px solid #e0e0e0;
    padding-top: 30px;
}

.output-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.output-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.output-section textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.5;
}

/* Profile preview box (used on main page) */
.profile-preview {
    background: linear-gradient(180deg, #fbfbff, #fff);
    border: 1px solid rgba(15,23,42,0.06);
    padding: 16px;
    border-radius: 8px;
    min-height: 140px;
    color: #111827;
    font-family: Inter, system-ui, -apple-system, 'Courier New', monospace;
    font-size: 0.95em;
    white-space: pre-wrap;
}

/* subtle card uplift for inputs inside profile forms */
.form-group input, .form-group textarea {
    background: linear-gradient(180deg, #fff, #fbfbff);
    border: 1px solid rgba(15,23,42,0.06);
}

/* improve modal visuals */
.modal-content {
    background: linear-gradient(180deg, #ffffff, #fbfbff);
    border-radius: 12px;
    max-width: 900px;
    max-height: 86vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 18px 60px rgba(2,6,23,0.16);
}

.modal-close {
    font-size: 1.6em;
    color: var(--muted);
}

/* responsive tweaks */
@media (max-width: 900px) {
    .container { padding: 18px; }
    header h1 { font-size: 1.6em; }
    .modal-content { padding: 18px; max-width: 94%; }
}

footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
}

/* Profile Section (Profiles Page) */
.profile-section {
    margin-bottom: 40px;
    padding: 22px;
    background: #fbfbfc;
    border-radius: 8px;
}

.profile-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

/* Profile Cards */
.profiles-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.profile-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.profile-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.profile-card-header {
    margin-bottom: 15px;
}

.profile-card-header h3 {
    color: #333;
    margin-bottom: 5px;
    word-break: break-word;
}

.profile-card-header small {
    color: #999;
    font-size: 0.85em;
}

.profile-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-edit,
.btn-view,
.btn-delete {
    flex: 1;
    min-width: 80px;
}

.btn-delete {
    background: #fee;
    border: 2px solid #f88;
    color: #c00;
}

.btn-delete:hover {
    background: #fdd;
}

.btn-edit,
.btn-view {
    background: #f0f0f0;
    border: 2px solid #e0e0e0;
    color: #333;
}

.btn-edit:hover,
.btn-view:hover {
    background: #e8e8e8;
    border-color: #667eea;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1em;
}

.hint {
    display: block;
    margin-top: 8px;
    color: #666;
    font-size: 0.9em;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

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

.modal-header h3 {
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-content pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.9em;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Micro-interactions and accessibility improvements */
.nav-link:focus,
.nav-link:hover{
    transform: translateY(-2px);
    text-decoration: none;
}

.form-group input:focus,
.form-group textarea:focus{
    border-color: var(--accent-1);
    box-shadow: 0 6px 18px rgba(102,126,234,0.12);
}

.btn:focus{
    outline: 3px solid rgba(102,126,234,0.12);
    outline-offset: 2px;
}

.profile-card {
    transition: transform 240ms cubic-bezier(.2,.9,.2,1), box-shadow 240ms ease, border-color 240ms ease;
}

.profile-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 18px 40px rgba(2,6,23,0.12);
    border-color: rgba(102,126,234,0.18);
}

.btn-primary:hover{
    transform: translateY(-3px) scale(1.01);
}

.hero-illustration svg{ transform-origin:center; }

/* subtle focus ring for inputs with keyboard */
input:focus-visible, textarea:focus-visible, button:focus-visible {
    outline: 3px solid rgba(102,126,234,0.14);
    outline-offset: 2px;
}

/* spacing refinements */
.profile-card-header h3{ margin-bottom:6px; }
.profile-card { padding:22px; }

/* small utility */
.muted { color: var(--muted); }

