/* ============================================
   Browser Storage Quota — Styles
   Theme: Dark, minimalist, utility-focused
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Dark theme (default) */
    --bg-primary: #0c0e14;
    --bg-card: #14171f;
    --bg-card-hover: #1a1e28;
    --bg-input: #1a1e28;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --text-primary: #e8eaf0;
    --text-secondary: #8b90a0;
    --text-muted: #5c6070;

    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.25);
    --accent-light: #8b83ff;
    --success: #34d399;
    --success-glow: rgba(52, 211, 153, 0.2);
    --warning: #fbbf24;
    --warning-glow: rgba(251, 191, 36, 0.2);
    --danger: #f87171;

    --gauge-track: rgba(255, 255, 255, 0.06);
    --gauge-fill-start: #6c63ff;
    --gauge-fill-end: #a78bfa;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;

    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme (system preference) */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f4f5f7;
        --bg-card: #ffffff;
        --bg-card-hover: #f8f9fb;
        --bg-input: #f0f1f3;
        --border-color: rgba(0, 0, 0, 0.08);
        --border-hover: rgba(0, 0, 0, 0.15);

        --text-primary: #1a1d26;
        --text-secondary: #6b7080;
        --text-muted: #9ba0b0;

        --gauge-track: rgba(0, 0, 0, 0.06);

        --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
    }
}

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

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

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

/* --- App Container --- */
.app-container {
    max-width: 560px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.header-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* --- Card --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

/* --- Gauge Card --- */
.gauge-card {
    text-align: center;
    margin-bottom: 16px;
}

.gauge-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-track {
    fill: none;
    stroke: var(--gauge-track);
    stroke-width: 10;
}

.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 534;
    stroke-dashoffset: 534;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-percent {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gauge-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

/* Legend */
.gauge-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-dot.used {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

.legend-dot.available {
    background: var(--success);
    box-shadow: 0 0 6px var(--success-glow);
}

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

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px;
    cursor: default;
}

.stat-card:hover {
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    color: var(--accent);
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

/* --- Breakdown Card --- */
.breakdown-card {
    margin-bottom: 16px;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.breakdown-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.breakdown-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.breakdown-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.breakdown-bar-track {
    width: 100%;
    height: 6px;
    background: var(--gauge-track);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--gauge-fill-start), var(--gauge-fill-end));
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.breakdown-percent {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    width: 44px;
    text-align: right;
}

.breakdown-placeholder {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.status-badge.granted {
    background: var(--success-glow);
    color: var(--success);
}

.status-badge.not-granted {
    background: var(--warning-glow);
    color: var(--warning);
}

.status-badge.unavailable {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

/* --- Actions --- */
.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

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

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

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

/* --- Info Card --- */
.info-card {
    margin-bottom: 16px;
}

.info-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 10px;
}

.info-text:last-child {
    margin-bottom: 0;
}

.info-text.muted {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.info-text code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    color: var(--accent-light);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding-top: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gauge-card {
    animation: fadeInUp 0.5s ease-out;
}

.stat-card {
    animation: fadeInUp 0.5s ease-out;
}

.stat-card:nth-child(1) {
    animation-delay: 0.05s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.2s;
}

.breakdown-card {
    animation: fadeInUp 0.5s ease-out 0.25s both;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.stat-value.loading {
    animation: pulse 1.5s ease-in-out infinite;
    color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .app-container {
        padding: 16px 12px 32px;
    }

    .gauge-container {
        width: 150px;
        height: 150px;
    }

    .gauge-percent {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
    }

    .gauge-legend {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }

    .actions {
        flex-direction: column;
    }
}