/**
 * CloudDrive - Google Drive Clone
 * Material Design 3 Inspired Styles
 */

:root {
    /* Google Material 3 Colors */
    --primary: #0b57d0;
    /* Google Blue */
    --primary-hover: #0842a0;
    --on-primary: #ffffff;

    --surface: #ffffff;
    --surface-container: #f3f6fc;
    /* Light blue-grey background */
    --surface-container-high: #edf2fa;

    --outline: #747775;
    --outline-variant: #c4c7c5;

    --on-surface: #1f1f1f;
    --on-surface-variant: #444746;

    --bg-body: #f8fafe;

    /* Functional Colors */
    --danger: #b3261e;
    --success: #146c2e;
    --warning: #ef9a9a;
    /* Using a tailored warning color */

    /* Spacing & Borders */
    --border-radius-sm: 8px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --border-radius-full: 9999px;

    /* Shadows */
    --elevation-1: 0 1px 2px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    /* Low shadow */
    --elevation-2: 0 2px 6px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.12);
    --elevation-3: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    /* Drive card shadow */

    /* Dimensions */
    --sidebar-width: 256px;
    --header-height: 64px;
}

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

body {
    font-family: 'Google Sans', 'Roboto', 'Arial', sans-serif;
    background-color: var(--bg-body);
    color: var(--on-surface);
    line-height: 1.5;
    font-size: 14px;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Typography Helper */
.display-large {
    font-size: 57px;
    line-height: 64px;
    letter-spacing: -0.25px;
}

.headline-medium {
    font-size: 28px;
    line-height: 36px;
}

.title-large {
    font-size: 22px;
    line-height: 28px;
    font-weight: 400;
}

.title-medium {
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.15px;
}

.label-large {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.1px;
}

/* -------------------------------------------------------------------------- */
/*                                AUTH PAGES                                  */
/* -------------------------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-container);
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    /* Google Sign-in width */
}

.auth-card {
    background: var(--surface);
    border-radius: 28px;
    /* Material 3 Card style */
    padding: 36px;
    box-shadow: none;
    /* Google sign in page is usually flat on white, but let's add subtle if needed or keep flat on container */
    border: 1px solid var(--outline-variant);
    text-align: center;
}

/* For cleaner look, remove border on mobile or very small screens if desired, but 1px solid is safe */
@media (max-width: 480px) {
    .auth-card {
        border: none;
        background: transparent;
        padding: 0;
    }

    .auth-page {
        background: var(--surface);
    }
}

.auth-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
}

.auth-logo svg,
.auth-logo img {
    width: 100%;
    height: 100%;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--on-surface);
}

.auth-header p {
    font-size: 16px;
    color: var(--on-surface-variant);
    margin-bottom: 32px;
}

.auth-form .form-floating {
    margin-bottom: 24px;
}

.auth-form .form-control {
    border-radius: 4px;
    /* Classic text field or rounded? Material 3 uses rounded containers or lines */
    border: 1px solid var(--outline);
    padding: 13px 15px;
    font-size: 16px;
    height: 56px;
    /* Material standard height */
    box-shadow: none;
}

.auth-form .form-control:focus {
    border-color: var(--primary);
    border-width: 2px;
    padding: 12px 14px;
    /* Adjust for border width increase */
}

.auth-form .btn-primary {
    background-color: var(--primary);
    border: none;
    border-radius: 20px;
    height: 40px;
    padding: 0 24px;
    font-weight: 500;
    font-size: 14px;
    color: var(--on-primary);
    transition: background-color 0.2s;
    float: right;
    /* Google often puts next button on right */
    width: auto;
    /* Allow full width if preferred, but Google does 'Next' buttons */
    min-width: 100px;
}

.auth-form .btn-primary.w-100 {
    width: 100%;
    float: none;
}

/* Use w-100 for login block */

.auth-form .btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.auth-link {
    color: var(--primary);
    font-weight: 500;
    font-size: 14px;
}

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

.auth-footer {
    margin-top: 32px;
    text-align: left;
}

/* Password Strength & Features hidden on login usually */
.auth-features {
    display: none;
}

/* -------------------------------------------------------------------------- */
/*                                DASHBOARD                                   */
/* -------------------------------------------------------------------------- */
.dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--surface);
}

/* Header */
.app-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--surface);
    border-bottom: none;
    /* Drive usually doesn't have a border */
    z-index: 100;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 230px;
    /* Space for sidebar alignment */
    font-size: 22px;
    color: #444746;
    /* Drive product text color */
}

.app-logo i {
    color: var(--primary);
    font-size: 28px;
}

.search-bar-container {
    flex: 1;
    max-width: 720px;
    margin: 0 48px;
}

.search-bar {
    background: var(--surface-container-high);
    border-radius: 24px;
    /* Pill shape */
    display: flex;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    transition: background 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.search-bar input {
    border: none;
    background: transparent;
    flex: 1;
    height: 100%;
    margin-left: 12px;
    font-size: 16px;
    color: var(--on-surface);
}

.search-bar input:focus {
    outline: none;
}

.search-bar i {
    color: var(--on-surface-variant);
    font-size: 20px;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-surface-variant);
    cursor: pointer;
}

.btn-icon-circle:hover {
    background: rgba(68, 71, 70, 0.08);
}

/* Main Layout */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.new-btn-wrapper {
    margin-bottom: 16px;
}

.new-btn {
    background: var(--surface);
    height: 56px;
    min-width: 110px;
    /* Adjust as needed */
    padding: 0 24px 0 16px;
    border-radius: 16px;
    box-shadow: var(--elevation-1);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow 0.2s, background-color 0.2s;
}

.new-btn:hover {
    box-shadow: var(--elevation-2);
    background: #f0f4f9;
    /* Slight hover color */
}

.new-btn span {
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface);
}

.new-btn i {
    font-size: 24px;
    color: #444746;
}

/* Plus icon color */

.nav-menu {
    list-style: none;
    padding: 0;
}

.nav-item {
    padding: 8px 16px 8px 16px;
    /* Left padding includes alignment */
    margin-bottom: 2px;
    border-radius: 100px;
    /* Fully rounded sides */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--on-surface);
    font-size: 14px;
}

.nav-item:hover {
    background-color: rgba(68, 71, 70, 0.08);
}

.nav-item.active {
    background-color: #c2e7ff;
    /* Active blue bg */
    color: #001d35;
    /* Active text color */
    font-weight: 500;
}

.nav-item i {
    font-size: 20px;
    color: var(--on-surface-variant);
    width: 20px;
    text-align: center;
}

.nav-item.active i {
    color: #001d35;
}

/* Storage Meter */
.storage-meter-container {
    margin-top: auto;
    padding: 16px;
}

.storage-progress {
    height: 4px;
    background: #e0e3e7;
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

.storage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
}

/* Main Content Surface */
.main-content {
    flex: 1;
    background: var(--surface-container);
    /* Checkered or light bg */
    border-radius: 16px 16px 0 0;
    /* Rounded top corners like Drive web */
    margin: 0 16px 0 0;
    /* Spacing from right */
    padding: 16px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Breadcrumb & Toolbar */
.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.breadcrumb-title {
    font-size: 18px;
    font-weight: 400;
    color: var(--on-surface);
}

/* Files Grid/List */
.files-section-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface-variant);
    margin: 24px 0 12px 0;
}

/* Grid View */
.drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.folder-card {
    background: var(--surface-container-high);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s;
}

.folder-card:hover {
    background-color: #dfe3e7;
    /* Darker hover */
}

.folder-card:focus,
.folder-card.selected {
    background-color: #c2e7ff;
    border-color: var(--primary);
}

.file-card {
    background: var(--surface-container-high);
    /* File cards usually have a preview area */
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s;
    border: 1px solid var(--outline-variant);
}

.file-card:hover {
    box-shadow: var(--elevation-1);
    background-color: #f0f4f9;
}

.file-preview {
    height: 140px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.file-preview i {
    font-size: 48px;
    color: var(--outline);
}

.file-footer {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    /* Footer is usually white */
}

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

/* List View (Table) */
.drive-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.drive-table th {
    text-align: left;
    padding: 0 12px 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface-variant);
    border-bottom: 1px solid var(--outline-variant);
}

.drive-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--outline-variant);
    /* Optional: Drive has faint lines */
    font-size: 14px;
    color: var(--on-surface);
    vertical-align: middle;
}

.drive-table tr:hover td {
    background-color: #f0f4f9;
}

.drive-table tr.selected td {
    background-color: #c2e7ff;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #fff;
    border-radius: 8px;
    /* More rounded */
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
    /* Google shadow */
    padding: 8px 0;
    min-width: 280px;
    /* Wider like Screenshot */
    z-index: 9999;
    display: none;
    border: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 8px 16px;
    /* Condensed vertical */
    display: flex;
    align-items: center;
    gap: 16px;
    color: #1f1f1f;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Google Sans', Roboto, Arial, sans-serif;
    transition: background-color 0.1s;
}

.context-menu-item:hover {
    background-color: #f2f2f2;
}

.context-menu-item i {
    font-size: 20px;
    color: #444746;
    width: 20px;
    text-align: center;
}

.context-menu-divider {
    height: 1px;
    background-color: #e0e2e6;
    margin: 8px 0;
}

.context-menu-item .shortcut {
    margin-left: auto;
    font-size: 12px;
    color: #444746;
    font-weight: 400;
}

/* Badge for "New" */
.context-menu-badge {
    background-color: #0b57d0;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    font-weight: 500;
}

.context-menu-arrow {
    margin-left: auto;
    color: #444746;
    font-size: 14px;
}

/* Share Modal Styles */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444746;
    transition: background-color 0.1s;
}

.btn-icon:hover {
    background-color: #f0f4f9;
}

#accessIconBg {
    transition: background-color 0.2s;
}

.dropdown-item {
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 4px;
    margin: 2px 0;
}

.dropdown-item.selected {
    background-color: #e8f0fe;
    color: #0b57d0;
}

.dropdown-item:active {
    background-color: #e8f0fe;
    color: #0b57d0;
}

/* Utilities */
.d-none {
    display: none !important;
}

.text-muted {
    color: var(--on-surface-variant) !important;
}

/* Responsive */
@media (max-width: 900px) {
    .app-sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        bottom: 0;
        background: var(--surface);
        z-index: 50;
        transition: left 0.3s;
        box-shadow: var(--elevation-3);
    }

    .app-sidebar.show {
        left: 0;
    }

    .main-content {
        margin-right: 0;
        border-radius: 0;
        background: var(--surface);
    }

    .search-bar-container {
        display: none;
    }

    /* Show search icon instead on mobile? */
    .app-logo {
        min-width: auto;
    }
}

/* -------------------------------------------------------------------------- */
/*                            PUBLIC SHARE PAGE                               */
/* -------------------------------------------------------------------------- */
.share-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-container);
    padding: 24px;
}

.share-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 480px;
    text-align: center;
    box-shadow: var(--elevation-2);
    border: 1px solid var(--outline-variant);
}

.share-icon {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 24px;
}

.share-icon img {
    border-radius: 8px;
    box-shadow: var(--elevation-1);
}

.share-filename {
    font-size: 24px;
    font-weight: 400;
    color: var(--on-surface);
    margin-bottom: 8px;
    word-break: break-all;
}

.share-meta {
    font-size: 14px;
    color: var(--on-surface-variant);
    margin-bottom: 24px;
}

.share-owner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--on-surface-variant);
    margin-bottom: 32px;
    background: var(--surface-container-high);
    padding: 8px 16px;
    border-radius: 50px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.preview-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-container img,
.preview-container video {
    max-width: 100%;
    max-height: 400px;
}

/* Validating the folder view in share page */
.drive-view {
    background-color: var(--bg-body);
}