/* FileSyncBook Webapp Styles */

:root {
    --bg: #0d1117;
    --card: #111827;
    --muted: #8ba4c7;
    --primary: #4fd1c5;
    --primary-strong: #2bb3a7;
    --danger: #f56565;
    --text: #e5ecf5;
    --accent: #f6ad55;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 20% 20%, rgba(79, 209, 197, 0.15), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(246, 173, 85, 0.16), transparent 30%),
    var(--bg);
    background-attachment: fixed;
    color: var(--text);
}

h1 {
    margin: 2px 0 0;
    font-size: 18px;
    letter-spacing: -0.2px;
}

p {
    margin: 0;
}

.muted {
    color: var(--muted);
    font-size: 12px;
}

.hidden {
    display: none !important;
}

.app {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

/* ============================================
   LOGIN PAGE STYLES
   ============================================ */

#login-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-hero {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 20px 50px rgba(79, 209, 197, 0.3);
    margin: 0 auto 24px;
}

.login-hero .eyebrow {
    color: var(--primary);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.login-hero h1 {
    font-size: 32px;
    margin: 0 0 12px;
    background: linear-gradient(135deg, var(--text), var(--muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-hero .tagline {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

.login-card {
    width: 100%;
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(17, 24, 39, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.login-card h2 {
    margin: 0 0 8px;
    font-size: 24px;
    text-align: center;
}

.login-card .subtitle {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
    margin-bottom: 32px;
    line-height: 1.5;
}

#google-signin-btn {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
}

.login-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(79, 209, 197, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-feature-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary);
}

/* ============================================
   APP SECTION STYLES
   ============================================ */

#app-section {
    padding-top: 8px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.title-block {
    display: flex;
    gap: 10px;
    align-items: center;
}

.logo-dot {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 10px 30px rgba(79, 209, 197, 0.25);
}

.eyebrow {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* User Header */
.user-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-display {
    font-size: 13px;
    color: var(--muted);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:active {
    transform: none;
}

.ghost {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ghost:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ghost.small {
    padding: 8px 10px;
    font-size: 12px;
}

/* Usage Section */
.usage-section {
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.92), rgba(17, 24, 39, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.usage-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.usage-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
}

.usage-label span:last-child {
    margin-left: auto;
}

.usage-bar {
    position: relative;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 999px;
    transition: width 200ms ease;
    width: 0;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.search-box {
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--muted);
}

.search-box input:focus {
    outline: 2px solid rgba(79, 209, 197, 0.6);
    border-color: transparent;
}

.sort-select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    min-width: 130px;
}

.sort-select option {
    background: var(--card);
    color: var(--text);
}

/* Skeleton Loading */
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.92), rgba(17, 24, 39, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

.skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-line.long {
    width: 70%;
}

.skeleton-line.short {
    width: 40%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Empty State */
.card {
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.92), rgba(17, 24, 39, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
}

.empty-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(79, 209, 197, 0.2), rgba(246, 173, 85, 0.2));
    position: relative;
}

.empty-icon::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 30px;
    border: 2px solid var(--muted);
    border-radius: 4px;
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 20px;
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 12px;
}

/* Files List */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.92), rgba(17, 24, 39, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    animation: fadeInUp 200ms ease backwards;
}

.file-item:nth-child(1) {
    animation-delay: 0ms;
}

.file-item:nth-child(2) {
    animation-delay: 50ms;
}

.file-item:nth-child(3) {
    animation-delay: 100ms;
}

.file-item:nth-child(4) {
    animation-delay: 150ms;
}

.file-item:nth-child(5) {
    animation-delay: 200ms;
}

.file-item:nth-child(n+6) {
    animation-delay: 250ms;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* File type colors */
.file-icon.pdf {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.file-icon.doc, .file-icon.docx {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.file-icon.xls, .file-icon.xlsx {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.file-icon.ppt, .file-icon.pptx {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.file-icon.png, .file-icon.jpg, .file-icon.jpeg, .file-icon.gif, .file-icon.webp {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.file-icon.txt, .file-icon.md {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.file-icon.default {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.file-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--muted);
}

.file-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-actions button {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.btn-open {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #0c101a;
    border: none;
}

.btn-open:hover {
    box-shadow: 0 4px 12px rgba(79, 209, 197, 0.3);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 30px 20px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
    max-width: 90%;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 200ms ease;
    pointer-events: auto;
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast.hiding {
    animation: slideOut 200ms ease forwards;
}

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

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

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Tablet and up */
@media (min-width: 768px) {
    .login-hero h1 {
        font-size: 40px;
    }

    .login-hero .tagline {
        font-size: 18px;
        max-width: 400px;
    }

    .login-card {
        padding: 48px 40px;
    }

    .login-features {
        flex-direction: row;
        justify-content: space-between;
    }

    .login-feature {
        flex-direction: column;
        text-align: center;
        flex: 1;
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .app {
        padding: 12px;
    }

    .controls {
        flex-direction: column;
    }

    .sort-select {
        min-width: 100%;
    }

    .file-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-hero h1 {
        font-size: 28px;
    }

    .login-hero .tagline {
        font-size: 14px;
    }

    #user-display {
        display: none;
    }
}
