/* ============================================================
   Tajalì - Dark Tiffany Theme
   Minimal design con note di skeumorfismo
   ============================================================ */

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

:root {
    --accent: #0ABAB5;
    --accent-light: #81D8D0;
    --accent-glow: rgba(10, 186, 181, 0.15);
    --accent-glow-strong: rgba(10, 186, 181, 0.3);
    --accent-hover: #08a09c;
    --accent-dark: #067a77;

    --bg-deep: #060610;
    --bg: #0c0c1a;
    --bg-card: #13132a;
    --bg-card-hover: #191940;
    --bg-elevated: #1a1a3a;
    --bg-input: #0e0e22;

    --text: #e8e8f0;
    --text-muted: #7a7a9a;
    --text-dim: #4a4a6a;

    --border: rgba(129, 216, 208, 0.08);
    --border-hover: rgba(129, 216, 208, 0.18);
    --border-accent: rgba(10, 186, 181, 0.3);

    --success: #34d399;
    --error: #f87171;
    --warning: #fbbf24;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --shadow: 0 2px 8px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 20px rgba(10, 186, 181, 0.08);
    --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.03), inset 0 -1px 0 rgba(0,0,0,0.2);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(10,186,181,0.06) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(10,186,181,0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

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

a:hover {
    color: var(--accent);
}

img {
    max-width: 100%;
    height: auto;
}

::selection {
    background: rgba(10, 186, 181, 0.3);
    color: #fff;
}

/* === Layout === */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 3rem;
}

/* === Header === */
.site-header {
    background: rgba(12, 12, 26, 0.85);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: -0.02em;
    text-shadow: 0 0 20px rgba(10, 186, 181, 0.3);
    transition: all var(--transition);
}

.logo:hover {
    color: #fff;
    text-shadow: 0 0 30px rgba(10, 186, 181, 0.5);
}

.main-nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.main-nav a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.main-nav a:hover {
    color: var(--accent-light);
    background: var(--accent-glow);
}

/* === Footer === */
.site-footer {
    background: rgba(6, 6, 16, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.footer-nav {
    display: flex;
    gap: 1.25rem;
}

.footer-nav a {
    color: var(--text-dim);
    transition: color var(--transition);
}

.footer-nav a:hover {
    color: var(--accent-light);
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(129,216,208,0.1), transparent 50%, rgba(10,186,181,0.05));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.card + .card {
    margin-top: 1rem;
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.3rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    gap: 0.4rem;
    position: relative;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 2px 12px rgba(10, 186, 181, 0.25), var(--shadow-inset);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: #fff;
    box-shadow: 0 4px 20px rgba(10, 186, 181, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 6px rgba(10, 186, 181, 0.2);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-hover);
    box-shadow: var(--shadow-inset);
}

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

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #fff;
    box-shadow: 0 2px 12px rgba(220, 38, 38, 0.2), var(--shadow-inset);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    box-shadow: var(--shadow-inset);
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399, #059669);
    color: #fff;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    border-radius: 6px;
}

.btn-block {
    width: 100%;
}

/* === Forms === */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.825rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text);
    transition: all var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), inset 0 0 0 1px rgba(255,255,255,0.02);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 3px rgba(10, 186, 181, 0.12);
}

.form-control::placeholder {
    color: var(--text-dim);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237a7a9a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

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

.form-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-with-status {
    position: relative;
}

.input-status {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    font-weight: 600;
}

.input-status.available {
    color: var(--success);
}

.input-status.taken {
    color: var(--error);
}

/* === Flash messages === */
.flash {
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid;
    backdrop-filter: blur(8px);
}

.flash-success {
    background: rgba(52, 211, 153, 0.08);
    border-color: rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.flash-error {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.2);
    color: var(--error);
}

.flash-warning {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

.flash-info {
    background: rgba(10, 186, 181, 0.08);
    border-color: rgba(10, 186, 181, 0.2);
    color: var(--accent-light);
}

/* === Tables === */
.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 0.7rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(0,0,0,0.2);
}

tr {
    transition: background var(--transition);
}

tr:hover td {
    background: rgba(10, 186, 181, 0.03);
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.18rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.badge-active {
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.badge-expired {
    background: rgba(248, 113, 113, 0.12);
    color: var(--error);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.badge-pin {
    background: rgba(10, 186, 181, 0.12);
    color: var(--accent-light);
    border: 1px solid rgba(10, 186, 181, 0.2);
}

.badge-suspended {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

/* === Stats cards === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::after {
    opacity: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* === Hero section (homepage) === */
.hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.hero-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 30px rgba(10, 186, 181, 0.3));
    animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Features grid === */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 2.5rem 0;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(10, 186, 181, 0.3), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-glow);
    border: 1px solid rgba(10, 186, 181, 0.12);
}

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* === Demo box (homepage) === */
.demo-box {
    max-width: 550px;
    margin: 2rem auto;
}

.demo-box .form-control {
    font-size: 0.95rem;
    padding: 0.8rem 1rem;
}

.demo-result {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--accent-light);
    display: none;
}

.demo-result.show {
    display: block;
    animation: fadeSlideIn 0.3s ease-out;
}

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

/* === Auth forms === */
.auth-wrapper {
    max-width: 420px;
    margin: 2rem auto;
}

.auth-wrapper h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text);
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* === Dashboard === */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.link-actions {
    display: flex;
    gap: 0.35rem;
}

/* === Link detail === */
.link-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.link-detail dt {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.link-detail dd {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

/* === QR code === */
.qr-container {
    text-align: center;
    padding: 1.5rem;
}

.qr-container img {
    max-width: 200px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 0.75rem;
    background: #fff;
}

/* === Admin === */
.admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.admin-tab {
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: 0.02em;
}

.admin-tab:hover {
    color: var(--accent-light);
}

.admin-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

/* === Utilities === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-small { font-size: 0.78rem; }
.text-mono { font-family: var(--font-mono); font-size: 0.85em; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

code {
    background: rgba(10, 186, 181, 0.08);
    color: var(--accent-light);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    border: 1px solid rgba(10, 186, 181, 0.1);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero-logo {
        width: 90px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .link-detail {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    table {
        font-size: 0.78rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .main-nav {
        gap: 0.15rem;
    }

    .main-nav a {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* === Edit URL inline === */
.edit-url-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.edit-url-display .truncate {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.edit-url-form .form-row {
    display: flex;
    flex-wrap: nowrap;
}
.ml-1 { margin-left: 0.5rem; }
