/* ---------- Global Styles ---------- */
html,
body {
    overflow-x: hidden;
}

body#home-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at 12% 0%, var(--color-hover-tint) 0%, var(--color-bg) 40%);
    overflow-x: hidden;
}

body#home-page > main {
    flex: 1 0 auto;
}

body#home-page > footer {
    margin-top: auto;
}

/* Main content wrapper */
main.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* start from top */
    align-items: center;
    padding: 60px 20px;
    gap: 40px;
}

/* ---------- Download Box (Form) ---------- */
.download-box {
    background-color: var(--color-surface);
    padding: 40px 30px;
    border-radius: 22px;
    box-shadow: 0 16px 40px rgba(29, 78, 216, 0.1), 0 4px 12px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.7);
    max-width: 500px;
    width: 100%;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.download-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 50px rgba(29, 78, 216, 0.14), 0 6px 16px rgba(15, 23, 42, 0.06);
}

.download-box .title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 25px;
    letter-spacing: -0.01em;
}

/* Form groups */
.download-box .form-group {
    margin-bottom: 15px;
    text-align: left;
}

.download-box label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--color-label);
}

.download-box input,
.download-box select,
.download-box textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--color-border);
    background-color: var(--color-bg-alt);
    color: var(--color-text);
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.download-box input:focus,
.download-box select:focus {
    border-color: var(--color-primary);
    background-color: var(--color-surface);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
    outline: none;
}

/* Download Button */
.download-box button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2563eb, var(--color-primary));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 8px 20px rgba(29, 78, 216, 0.25);
    transition: box-shadow 0.25s ease, transform 0.15s ease, background 0.25s ease;
}

.download-box button:hover:enabled {
    background: linear-gradient(135deg, #2f6df0, var(--color-primary-dark));
    box-shadow: 0 12px 26px rgba(29, 78, 216, 0.32);
    transform: translateY(-2px);
}

.download-box button:active:enabled {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(29, 78, 216, 0.28);
}

.download-box button:disabled {
    background: var(--color-border-accent);
    box-shadow: none;
    cursor: not-allowed;
}

/* ---------- Card Section ---------- */
.card {
    background-color: var(--color-surface);
    padding: 30px 25px;
    border-radius: 22px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    border: 1px solid rgba(226, 232, 240, 0.7);
    max-width: 900px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 30px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Info section */
.info h2 {
    color: var(--color-primary);
    font-size: 22px;
    margin-bottom: 10px;
    text-align: center;
}

.info p,
.info ul {
    color: var(--color-text-secondary);
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}

.info ul {
    list-style-type: none;
    padding-left: 20px;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.1);
}

/* Platforms section */

.platforms {
    text-align: center;
}

.platforms h2 {
    color: var(--color-primary);
    font-size: 20px;
    margin-bottom: 15px;
}

.platform-icons a {
    display: inline-block;
    margin-right: 15px;
    padding: 10px;
    border-radius: 18px;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.platform-icons a img {
    width: 100px;
    height: 100px;
    display: block;
}

.platform-icons a:hover {
    transform: scale(1.08) translateY(-2px);
    background-color: var(--color-hover-tint);
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.14);
}

/* Responsive */
@media (max-width: 768px) {
    .card {
        padding: 20px;
        gap: 20px;
    }

    .download-box {
        padding: 30px 20px;
    }

    .platform-icons a img {
        width: 40px;
        height: 40px;
    }
}

/* Header & Footer remain same */
header {
    background: linear-gradient(135deg, #2151e0, var(--color-primary) 55%, #1a3fc0);
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

footer {
    background: linear-gradient(135deg, #2151e0, var(--color-primary) 55%, #1a3fc0);
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid var(--color-border);
}


/* Navbar container */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 12px;
    background-color: var(--color-primary);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Navbar links */
.navbar a {
    color: white;
    text-decoration: none;
    margin: 0;
    font-weight: 500;
}

.navbar a:hover {
    text-decoration: underline;
}

.navbar-left,
.navbar-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

.navbar-left {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

/* Right side links */
.navbar-right {
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-left: auto;
}

.nav-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.nav-profile img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-profile span {
    max-width: 16ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-profile.is-large img {
    width: 32px;
    height: 32px;
}

@media (max-width: 768px) {
    header {
        padding: 12px 0;
    }

    header h1 {
        font-size: 26px;
        margin: 0;
    }

    .navbar {
        padding: 10px 12px;
        justify-content: space-between;
        flex-wrap: nowrap;
    }

    .navbar-left,
    .navbar-right {
        width: auto;
        justify-content: flex-start;
    }

    .navbar-left {
        align-items: flex-start;
    }

    .navbar-right {
        margin-left: auto;
    }

    .navbar a {
        font-size: 18px;
    }

    .nav-profile img {
        width: 24px;
        height: 24px;
    }
}

.download-progress {
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow);
}

.download-progress .dp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
}

.download-progress .dp-bar {
    height: 10px;
    background: var(--color-bg-alt);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.download-progress .dp-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, var(--color-primary));
    transition: width .3s ease;
}

.download-progress .dp-meta {
    font-size: .9rem;
    color: var(--color-text-secondary)
}


/* Layout */
.file-manager {
    max-width: 1100px;
    margin: 24px auto;
    padding: 16px
}

.page-title {
    font-size: 22px;
    margin: 0 0 8px 0
}

/* Touch toolbar */
.fm-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px
}

.fm-toolbar .btn {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    padding: 12px 14px;
    min-height: 44px;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 16px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.fm-ico {
    display: inline-block;
    margin-inline-end: 6px;
    font-size: 14px;
    line-height: 1;
    vertical-align: middle;
    transition: transform 0.15s ease;
}

.fm-toolbar .btn:hover .fm-ico {
    transform: scale(1.15);
}

.fm-toolbar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
    border-color: var(--color-border-accent);
}

.fm-toolbar label.btn {
    display: inline-flex;
    align-items: center
}

/* Breadcrumb */
.fm-breadcrumb {
    margin: 12px 0;
    color: var(--color-subtle);
    overflow: auto;
    -webkit-overflow-scrolling: touch
}

.fm-breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
    border-radius: 6px;
    padding: 2px 4px;
    transition: background-color 0.15s ease;
}

.fm-breadcrumb a:hover {
    background-color: var(--color-hover-tint);
}

/* Panel */
.fm-panel {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch
}

.fm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border)
}

.fm-sort {
    display: flex;
    gap: 8px;
    align-items: center
}

.fm-sort select {
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    padding: 6px 10px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fm-sort select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
    outline: none;
}

/* Grid */
.fm-grid {
    width: 100%;
    border-collapse: collapse
}

.fm-grid th,
.fm-grid td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    font-size: 15px
}

.fm-grid tbody tr {
    transition: background-color 0.15s ease;
}

.fm-grid tbody tr:hover {
    background-color: var(--color-hover-tint);
}

.fm-grid th {
    background: var(--color-bg-alt);
    font-weight: 600
}

.fm-name {
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-word
}

.fm-type {
    font-size: .9rem;
    color: var(--color-subtle)
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-alt);
    font-size: .8rem
}

/* Selection */
tr.selected {
    outline: 2px solid rgba(29, 78, 216, .35);
    background-color: var(--color-hover-tint);
}

/* Upload input hidden */
input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

/* Drag & drop */
.dropzone {
    border: 2px dashed var(--color-border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    color: var(--color-subtle);
    margin: 10px 12px;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.dropzone.drag {
    background: rgba(29, 78, 216, 0.06);
    color: var(--color-primary);
    border-color: var(--color-primary)
}

/* ---------- Toggle Switch (matches form style) ---------- */

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toggle-label {
    font-weight: 500;
    color: var(--color-label);
    font-size: 14px;
}

/* Toggle container */
.toggle-switch {
    position: relative;
    width: 46px;
    height: 26px;
}

/* Hide native checkbox */
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Track */
.toggle-slider {
    position: absolute;
    inset: 0;
    background-color: var(--color-border);
    /* same as borders */
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease;
    box-shadow: inset 0 0 0 1px var(--color-border);
}

/* Knob */
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background-color: var(--color-surface);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ON state */
.toggle-switch input:checked+.toggle-slider {
    background: linear-gradient(135deg, #2563eb, var(--color-primary));
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
}


/* Mobile */
@media (max-width: 640px) {
    .file-manager {
        padding: 12px;
        margin: 10px
    }

    .page-title {
        font-size: 20px
    }

    .fm-header {
        flex-direction: column;
        align-items: stretch
    }

    .fm-sort {
        justify-content: space-between;
        flex-wrap: wrap;
        width: 100%;
        gap: 8px;
    }

    .fm-sort label,
    .fm-sort select {
        min-width: 0;
    }

    .fm-grid thead {
        display: none
    }

    .fm-grid,
    .fm-grid tbody,
    .fm-grid tr,
    .fm-grid td {
        display: block;
        width: 100%
    }

    .fm-grid tr {
        background: var(--color-bg);
        width: calc(100% - 8px);
        margin: 10px auto;
        border: 1px solid var(--color-border);
        border-radius: 12px;
        box-shadow: var(--shadow);
        box-sizing: border-box;
    }

    .fm-grid td {
        border-bottom: 0;
        padding: 10px 12px;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .fm-grid td[data-col]:before {
        content: attr(data-col) ": ";
        font-weight: 600;
        color: var(--color-subtle);
        margin-right: 4px
    }

    .fm-grid td:first-child {
        display: none
    }

    .fm-toolbar .btn {
        flex: 1 1 auto;
        text-align: center
    }

    .fm-toolbar {
        position: sticky;
        top: 8px;
        z-index: 10;
        background: var(--color-bg)
    }

    /* Mobile users usually upload via picker/camera; hide drag-drop hint. */
    .dropzone {
        display: none;
    }
}

html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] .navbar {
    direction: rtl;
}

html[dir="rtl"] .navbar-right {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .navbar-left {
    align-items: flex-end;
}

html[dir="rtl"] .download-box .form-group,
html[dir="rtl"] .file-manager,
html[dir="rtl"] .page-wrapper {
    text-align: right;
}

html[dir="rtl"] .fm-grid th,
html[dir="rtl"] .fm-grid td,
html[dir="rtl"] .fm-name,
html[dir="rtl"] .fm-sort,
html[dir="rtl"] .fm-breadcrumb {
    text-align: right;
}

html[dir="rtl"] .fm-name {
    justify-content: flex-start;
}

html[dir="rtl"] .fm-grid td[data-col]:before {
    margin-right: 0;
    margin-left: 4px;
}

html[dir="rtl"] .fm-ico {
    margin-inline-end: 0;
    margin-inline-start: 6px;
}

/* ---------- Subscription Plan Cards ---------- */
.plan-card {
    position: relative;
    border-radius: 16px;
    padding: 20px 18px;
    text-align: center;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(29, 78, 216, 0.14);
}

.plan-card.is-current {
    cursor: default;
    border-color: var(--color-success);
    background: var(--color-success-bg);
}

.plan-card.is-current:hover {
    transform: none;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
}

.plan-card.is-popular {
    border-color: var(--color-accent);
    background: var(--color-bg-alt);
}

.plan-card.is-selected {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.plan-badge.is-popular {
    background: linear-gradient(135deg, #7c8ef0, var(--color-accent));
}

.plan-badge.is-current {
    background: linear-gradient(135deg, #34d399, var(--color-success));
}

.plan-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.plan-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--color-accent);
    margin-bottom: 8px;
}

.plan-meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 14px;
}

.plan-features {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.plan-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--color-text-secondary);
}

.plan-features li::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--color-accent);
    flex-shrink: 0;
}

.plan-btn {
    border: none;
    color: #ffffff;
    padding: 11px 18px;
    border-radius: 10px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.18);
}

.plan-btn:hover:enabled {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.plan-btn:disabled {
    cursor: default;
    box-shadow: none;
}

.plan-btn.is-current {
    background: linear-gradient(135deg, #34d399, var(--color-success));
}

.plan-btn.is-upgrade {
    background: linear-gradient(135deg, #7c8ef0, var(--color-accent));
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

html[dir="rtl"] .plan-features {
    text-align: right;
}

/* ---------- Centred content card (subscription, terms, privacy) ---------- */
.profile-center {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 14px;
    box-sizing: border-box;
}

.profile-center > .page-wrapper {
    align-items: center;
}
