/* ============================================================
   SecureShare — style.css
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --primary: #059669;
    --primary-light: #10b981;
    --primary-dim: #ecfdf5;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface2: #f1f5f9;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --error: #dc2626;
    --warn: #d97706;
    --ok: #059669;
    --blue: #2563eb;
    --radius: 8px;
    --radius-md: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 16px rgba(0, 0, 0, .06);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
    --transition: .18s ease;
}

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

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
    line-height: 1.25;
}

a {
    color: var(--primary-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    color: var(--muted);
}

strong {
    color: var(--text);
}

/* ── Auth pages ────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 1rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: .25rem;
}

.auth-sub {
    text-align: center;
    color: var(--muted);
    font-size: .95rem;
    margin-bottom: 1.75rem;
}

.auth-form .field {
    margin-bottom: 1rem;
}

.auth-form .btn-full {
    margin-top: .5rem;
}

.auth-foot {
    text-align: center;
    font-size: .9rem;
    color: var(--muted);
    margin-top: 1.25rem;
}

.auth-foot a {
    color: var(--primary-light);
}

/* Bouton "Se connecter avec Microsoft" */
.btn-microsoft {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    width: 100%;
    padding: .7rem 1.2rem;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #d0d5dd;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), box-shadow var(--transition);
}

.btn-microsoft:hover {
    background: #f4f4f4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    text-decoration: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.25rem 0;
    color: var(--muted);
    font-size: .85rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Navbar / top bar ──────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 56px;
}

.navbar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}

.navbar-tabs {
    display: flex;
    gap: .25rem;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.navbar-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    padding: .4rem .85rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.nav-tab:hover {
    background: var(--border);
    color: var(--text);
}

.nav-tab.active {
    background: var(--primary-dim);
    color: var(--primary);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--muted);
    flex-shrink: 0;
}

.navbar-user a {
    color: var(--muted);
}

.navbar-user a:hover {
    color: var(--text);
    text-decoration: none;
}

/* ── Dashboard layout ──────────────────────────────────────── */
.dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.tab-section {
    display: none;
}

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

/* ── Card ──────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-wide {
    max-width: 100%;
}

.card-header-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    flex: 1;
}

/* ── Fields & inputs ───────────────────────────────────────── */
.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: .35rem;
}

.field-full {
    grid-column: 1 / -1;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=datetime-local],
select,
textarea {
    width: 100%;
    padding: .55rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
}

input[readonly] {
    cursor: default;
    color: var(--muted);
    background: var(--surface2);
}

select option {
    background: var(--surface);
    color: var(--text);
}

textarea.textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.6;
    font-family: monospace;
    font-size: .9rem;
}

/* ── Type tabs (text / file) ───────────────────────────────── */
.type-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}

.type-tab {
    padding: .4rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: .9rem;
    cursor: pointer;
    transition: all var(--transition);
}

.type-tab.active {
    background: var(--primary-dim);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ── Dropzone ──────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    transition: all var(--transition);
    background: var(--surface2);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-dim);
    color: var(--primary);
}

.dropzone .dz-icon {
    font-size: 2.5rem;
    margin-bottom: .5rem;
}

.dropzone .dz-label {
    font-size: .95rem;
}

.dropzone .dz-hint {
    font-size: .8rem;
    margin-top: .25rem;
}

.dropzone input[type=file] {
    display: none;
}

.file-selected {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-top: .75rem;
}

.file-selected-name {
    font-size: .9rem;
    flex: 1;
    word-break: break-all;
}

.file-selected-size {
    font-size: .8rem;
    color: var(--muted);
}

/* ── Options panel ─────────────────────────────────────────── */
.options-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .9rem;
    cursor: pointer;
    user-select: none;
    margin-bottom: 1rem;
}

.options-toggle:hover {
    color: var(--text);
}

.options-toggle .arrow {
    transition: transform var(--transition);
}

.options-toggle.open .arrow {
    transform: rotate(90deg);
}

.options-panel {
    display: none;
    margin-bottom: 1rem;
}

.options-panel.open {
    display: block;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* ── Toggle switches ───────────────────────────────────────── */
.toggles-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .9rem;
    color: var(--muted);
    user-select: none;
}

.toggle-label:hover {
    color: var(--text);
}

.toggle-label input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.e2e-warning {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 3px solid var(--blue);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    font-size: .85rem;
    color: #1d4ed8;
    margin-top: .5rem;
    display: none;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.3rem;
    border: none;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover {
    opacity: .85;
    text-decoration: none;
}

.btn:active {
    transform: scale(.97);
}

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

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-sm {
    padding: .3rem .75rem;
    font-size: .85rem;
}

.btn-lg {
    padding: .7rem 1.8rem;
    font-size: 1rem;
}

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

.btn:disabled {
    opacity: .45;
    cursor: default;
}

/* ── Result box ────────────────────────────────────────────── */
.result-box {
    background: var(--primary-dim);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-top: 1rem;
    display: none;
}

.result-box.visible {
    display: block;
}

.url-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
}

.url-row input {
    flex: 1;
    font-family: monospace;
    font-size: .85rem;
}

.qr-container {
    text-align: center;
    margin-top: .75rem;
    display: none;
}

.qr-container img {
    border-radius: var(--radius);
    max-width: 200px;
}

.qr-container.visible {
    display: block;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

th {
    padding: .7rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    background: var(--surface2);
    white-space: nowrap;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

td {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fafbfc;
}

.empty-msg {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-size: .95rem;
}

code {
    font-family: monospace;
    font-size: .85rem;
    background: var(--surface2);
    color: var(--primary);
    padding: .1rem .35rem;
    border-radius: 4px;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-blue {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-green {
    background: #ecfdf5;
    color: #065f46;
}

.badge-yellow {
    background: #fffbeb;
    color: #92400e;
}

.badge-red {
    background: #fef2f2;
    color: #991b1b;
}

.badge-muted {
    background: var(--surface2);
    color: var(--muted);
}

.badge-beta {
    background: var(--primary-dim);
    color: var(--primary);
    font-size: .7rem;
    vertical-align: middle;
}

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
    padding: .8rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: .9rem;
}

.alert-warn {
    background: #fffbeb;
    border-left: 3px solid var(--warn);
    color: #92400e;
}

.alert-error {
    background: #fef2f2;
    border-left: 3px solid var(--error);
    color: #991b1b;
}

.alert-ok {
    background: #ecfdf5;
    border-left: 3px solid var(--ok);
    color: #065f46;
}

.alert-info {
    background: #eff6ff;
    border-left: 3px solid var(--blue);
    color: #1d4ed8;
}

/* ── Flash messages ────────────────────────────────────────── */
.flash-container {
    padding: 1rem 1.5rem 0;
}

.flash {
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: .5rem;
    font-size: .9rem;
}

.flash-error {
    background: #fef2f2;
    border-left: 3px solid var(--error);
    color: #991b1b;
}

.flash-success {
    background: #ecfdf5;
    border-left: 3px solid var(--ok);
    color: #065f46;
}

.flash-info {
    background: #eff6ff;
    border-left: 3px solid var(--blue);
    color: #1d4ed8;
}

.flash-warning {
    background: #fffbeb;
    border-left: 3px solid var(--warn);
    color: #92400e;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--text);
    color: #fff;
    padding: .65rem 1.5rem;
    border-radius: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
    font-size: .9rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: var(--error);
}

.toast.ok {
    background: var(--ok);
}

/* ── Inline form (api key reveal etc.) ────────────────────── */
.inline-form {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.inline-form input {
    flex: 1;
    min-width: 140px;
}

.key-reveal {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: .75rem 1rem;
    font-family: monospace;
    font-size: .9rem;
    color: #1d4ed8;
    word-break: break-all;
    margin-top: .75rem;
    display: none;
}

.key-reveal.visible {
    display: block;
}

/* ── Muted / utility ───────────────────────────────────────── */
.muted {
    color: var(--muted);
    font-size: .85rem;
}

.link {
    color: var(--primary-light);
    cursor: pointer;
}

.link:hover {
    text-decoration: underline;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: .5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.flex-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}

.flex-end {
    justify-content: flex-end;
}

.gap-1 {
    gap: .5rem;
}

/* ── Sensitive content (preview) ───────────────────────────── */
.preview-box {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    font-size: .9rem;
    color: var(--muted);
    font-style: italic;
    margin-top: .5rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .navbar {
        padding: 0 1rem;
        gap: .5rem;
    }

    .navbar-brand span {
        display: none;
    }

    .nav-tab {
        padding: .4rem .6rem;
        font-size: .82rem;
    }

    .dashboard {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.75rem 1.25rem;
    }

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

    .table-wrap {
        font-size: .82rem;
    }

    th,
    td {
        padding: .55rem .75rem;
    }
}

@media (max-width: 400px) {
    .toggles-row {
        flex-direction: column;
        gap: .5rem;
    }

    .url-row {
        flex-direction: column;
    }
}