/* ═══════════════════════════════════════════════════════════
   Studio Kit — Main Stylesheet
   Aesthetic: Warm pastels, soft radius, editorial clarity
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ──────────────────────────────────────────── */
:root {
    --bg-page: #FBF7F4;
    --bg-card: #FFFFFF;
    --bg-sidebar: #F5EDE8;
    --bg-input: #F8F4F1;
    --text-primary: #2D2A26;
    --text-secondary: #7A736D;
    --text-muted: #B0A8A1;
    --border: #EDE6E0;
    --border-hover: #D9CFC7;
    --shadow-sm: 0 1px 3px rgba(45,42,38,0.04), 0 1px 2px rgba(45,42,38,0.06);
    --shadow-md: 0 4px 12px rgba(45,42,38,0.06), 0 2px 4px rgba(45,42,38,0.04);
    --shadow-lg: 0 10px 30px rgba(45,42,38,0.08), 0 4px 8px rgba(45,42,38,0.04);
    --shadow-xl: 0 20px 50px rgba(45,42,38,0.1);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --font-display: 'Outfit', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --accent: #F2A365;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FBF7F4 0%, #F5EDE8 50%, #FCEEE4 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(242,163,101,0.12) 0%, transparent 70%);
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(195,174,214,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo img {
    max-height: 48px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 6px;
}

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

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(242,163,101,0.15);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--text-primary);
    color: #FFF;
    width: 100%;
}

.btn-primary:hover {
    background: #1a1816;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

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

.btn-accent {
    background: var(--accent);
    color: #FFF;
}

.btn-accent:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
    font-size: 1.1rem;
}

.login-error {
    background: #FEF0EE;
    color: #C53030;
    border: 1px solid #FECACA;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.88rem;
    margin-bottom: 20px;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-header-left img {
    height: 32px;
}

.app-header-left h1 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-input);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-badge .material-symbols-rounded {
    font-size: 1rem;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 32px 60px;
}

.dashboard-greeting {
    margin-bottom: 32px;
}

.dashboard-greeting h2 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.dashboard-greeting p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ── Tool Grid ─────────────────────────────────────────── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 30px 26px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid transparent;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.18;
    border-radius: inherit;
    background: inherit;
    z-index: 0;
}

.tool-card > * {
    position: relative;
    z-index: 1;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #FFF;
}

.tool-card h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.tool-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tool-card-arrow {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.tool-card:hover .tool-card-arrow {
    background: rgba(255,255,255,0.9);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   TOOL PAGES
   ═══════════════════════════════════════════════════════════ */
.tool-page {
    min-height: 100vh;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.tool-header .back-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.tool-header .back-btn:hover {
    background: var(--bg-input);
    border-color: var(--border-hover);
}

.tool-header h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ── Cards & Panels ────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 20px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .material-symbols-rounded {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ── Tabs ──────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    white-space: nowrap;
    border: none;
    background: none;
    font-family: var(--font-body);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ── Tag / Badge ───────────────────────────────────────── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-input);
    color: var(--text-secondary);
}

/* ── Search ────────────────────────────────────────────── */
.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-box input {
    width: 100%;
    padding: 14px 18px 14px 48px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(242,163,101,0.15);
}

.search-box .material-symbols-rounded {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* ── Prompt Card ───────────────────────────────────────── */
.prompt-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 14px;
    transition: var(--transition);
}

.prompt-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.prompt-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.prompt-card-header h4 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.98rem;
}

.prompt-card p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ── Checklist ─────────────────────────────────────────── */
.checklist-phase {
    margin-bottom: 28px;
}

.checklist-phase-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
}

.checklist-item:hover {
    background: var(--bg-input);
}

.checklist-item input[type="checkbox"] {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    position: relative;
}

.checklist-item input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checklist-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FFF;
    font-size: 0.8rem;
    font-weight: 700;
}

.checklist-item.checked label {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-item label {
    cursor: pointer;
    font-size: 0.92rem;
}

/* ── Progress bar ──────────────────────────────────────── */
.progress-bar-container {
    margin-bottom: 28px;
}

.progress-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 10px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #E8955A);
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* ── Links list ────────────────────────────────────────── */
.link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
}

.link-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-input);
    transform: translateX(4px);
}

.link-item-info h4 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.link-item-info p {
    font-size: 0.83rem;
    color: var(--text-secondary);
}

/* ── Fornecedor card ───────────────────────────────────── */
.fornecedor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 14px;
    transition: var(--transition);
}

.fornecedor-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.fornecedor-card h4 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.02rem;
    margin-bottom: 4px;
}

.fornecedor-card .servico {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.fornecedor-card .contacto {
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fornecedor-card .notas {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── QR Generator specifics ────────────────────────────── */
.qr-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #FFF;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    min-height: 300px;
}

.qr-preview svg {
    max-width: 280px;
    max-height: 280px;
}

.qr-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .qr-options {
        grid-template-columns: 1fr;
    }
}

/* ── AF Checker ────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(242,163,101,0.05);
}

.upload-zone .material-symbols-rounded {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-zone h3 {
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: 6px;
}

.upload-zone p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 0.92rem;
}

.result-item.pass {
    background: #F0FAF0;
    border: 1px solid #C6F6D5;
}

.result-item.warn {
    background: #FFF9E6;
    border: 1px solid #FEEBC8;
}

.result-item.fail {
    background: #FEF0EE;
    border: 1px solid #FECACA;
}

.result-item .material-symbols-rounded {
    font-size: 1.2rem;
}

.result-item.pass .material-symbols-rounded { color: #38A169; }
.result-item.warn .material-symbols-rounded { color: #D69E2E; }
.result-item.fail .material-symbols-rounded { color: #E53E3E; }

/* ═══════════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════════ */
.admin-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 28px;
    overflow-x: auto;
}

.admin-nav a {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.admin-nav a:hover { color: var(--text-primary); }

.admin-nav a.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 14px;
    transition: var(--transition);
}

.admin-item:hover {
    border-color: var(--border-hover);
}

.admin-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.admin-item-header h4 {
    font-family: var(--font-display);
    font-weight: 600;
}

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

.tool-color-preview {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid var(--border);
    cursor: pointer;
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--text-primary);
    color: #FFF;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-header { padding: 16px 20px; }
    .app-container { padding: 24px 20px 40px; }
    .dashboard-greeting h2 { font-size: 1.5rem; }
    .tools-grid { grid-template-columns: 1fr; }
    .card { padding: 22px; }
    .login-card { padding: 36px 28px; }
    .qr-options { grid-template-columns: 1fr; }
}

/* ── Material Icons ────────────────────────────────────── */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

/* ── Copy animation ────────────────────────────────────── */
.copy-btn.copied {
    color: #38A169 !important;
}

/* ── Grid layout for tool content ──────────────────────── */
.tool-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .tool-grid-2 { grid-template-columns: 1fr; }
}

/* ── Lorem output ──────────────────────────────────────── */
.lorem-output {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px;
    min-height: 200px;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-secondary);
    position: relative;
}

/* ── Category pill ─────────────────────────────────────── */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.category-pill {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font-body);
}

.category-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.category-pill.active {
    background: var(--text-primary);
    color: #FFF;
    border-color: var(--text-primary);
}
