/* =========================================================
   STORY PORTAL
   Main stylesheet
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-soft: #fff7ed;

    --black: #111111;
    --black-soft: #181818;
    --white: #ffffff;

    --grey-50: #fafafa;
    --grey-100: #f5f5f5;
    --grey-200: #e5e5e5;
    --grey-300: #d4d4d4;
    --grey-400: #a3a3a3;
    --grey-500: #737373;
    --grey-600: #525252;
    --grey-700: #404040;
    --grey-800: #262626;

    --success: #16a34a;
    --success-soft: #f0fdf4;

    --warning: #d97706;
    --warning-soft: #fffbeb;

    --danger: #dc2626;
    --danger-soft: #fef2f2;

    --blue: #2563eb;
    --blue-soft: #eff6ff;

    --border: #e7e5e4;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);

    --sidebar-width: 250px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    background: var(--grey-50);
    color: var(--black);
    line-height: 1.5;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}


/* =========================================================
   AUTHENTICATION
   ========================================================= */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;

    background:
        radial-gradient(
            circle at top left,
            rgba(249, 115, 22, 0.08),
            transparent 35%
        ),
        var(--grey-50);
}

.auth-wrapper {
    width: 100%;
    max-width: 460px;
}

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;

    box-shadow: var(--shadow-md);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--black);
    color: var(--white);

    border-radius: 11px;

    font-size: 18px;
    font-weight: 800;
}

.auth-brand strong {
    display: block;

    color: var(--black);
    font-size: 18px;
    font-weight: 750;
    line-height: 1.1;
}

.auth-brand span {
    display: block;

    margin-top: 3px;

    color: var(--grey-500);
    font-size: 12px;
}

.auth-heading {
    margin-bottom: 26px;
}

.auth-heading h1 {
    margin-bottom: 7px;

    color: var(--black);
    font-size: 28px;
    font-weight: 750;
    letter-spacing: -0.7px;
}

.auth-heading p {
    color: var(--grey-500);
    font-size: 14px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;

    color: var(--grey-700);
    font-size: 13px;
    font-weight: 650;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;

    padding: 12px 14px;

    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-sm);

    color: var(--black);
    font-size: 14px;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(249, 115, 22, 0.10);
}

.account-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;

    margin-bottom: 20px;
}

.account-option {
    padding: 15px;

    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.account-option:hover {
    border-color: var(--grey-300);
    background: var(--grey-50);
}

.account-option input {
    display: none;
}

.account-option.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.account-option strong {
    display: block;

    margin-bottom: 3px;

    font-size: 14px;
}

.account-option span {
    color: var(--grey-500);
    font-size: 12px;
}

.btn-primary {
    width: 100%;

    padding: 13px 18px;

    border: 0;
    border-radius: var(--radius-sm);

    background: var(--black);
    color: var(--white);

    font-size: 14px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.alert {
    margin-bottom: 18px;
    padding: 12px 14px;

    border-radius: var(--radius-sm);

    font-size: 13px;
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.auth-footer {
    margin-top: 22px;

    color: var(--grey-500);
    font-size: 13px;
    text-align: center;
}

.auth-footer a {
    color: var(--black);
    font-weight: 700;
}

.auth-footer a:hover {
    color: var(--primary);
}


/* =========================================================
   PORTAL SHELL
   ========================================================= */

.portal-shell {
    min-height: 100vh;
    background: var(--grey-50);
}

.portal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: var(--sidebar-width);

    display: flex;
    flex-direction: column;

    background: var(--black);
    color: var(--white);

    z-index: 1000;

    overflow-y: auto;
}

.portal-sidebar::-webkit-scrollbar {
    width: 4px;
}

.portal-sidebar::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 10px;
}


/* =========================================================
   PORTAL BRAND
   ========================================================= */

.portal-brand {
    padding: 27px 22px 24px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-brand-link {
    display: flex;
    align-items: center;
    gap: 11px;

    color: var(--white);
}

.portal-brand-link:hover {
    color: var(--white);
}

.portal-brand-mark {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--white);
    color: var(--black);

    border-radius: 10px;

    font-size: 15px;
    font-weight: 800;
}

.portal-brand-name {
    display: block;

    color: var(--white);
    font-size: 17px;
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.3px;
}

.portal-role {
    display: block;

    margin-top: 3px;

    color: #8d8d8d;
    font-size: 11px;
    font-weight: 500;

    text-transform: capitalize;
}


/* =========================================================
   PORTAL NAVIGATION
   ========================================================= */

.portal-navigation {
    flex: 1;

    padding: 22px 13px;
}

.portal-nav-label {
    padding: 0 10px;
    margin-bottom: 9px;

    color: #707070;

    font-size: 10px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: 1px;
}

.portal-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;

    width: 100%;

    margin-bottom: 4px;
    padding: 10px 11px;

    border-radius: 9px;

    color: #a5a5a5;

    font-size: 13px;
    font-weight: 550;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.portal-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
}

.portal-nav-item.active {
    background: var(--white);
    color: var(--black);
}

.portal-nav-icon {
    width: 18px;
    height: 18px;

    flex: 0 0 18px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-nav-icon svg {
    width: 17px;
    height: 17px;
}


/* =========================================================
   WRITE STORY CTA
   ========================================================= */

.portal-create-story {
    margin: 8px 13px 20px;
    padding: 15px;

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;

    background: rgba(255, 255, 255, 0.04);
}

.portal-create-story p {
    margin-bottom: 10px;

    color: #858585;
    font-size: 11px;
    line-height: 1.5;
}

.portal-create-story a {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;

    padding: 10px 12px;

    border-radius: 8px;

    background: var(--primary);
    color: var(--white);

    font-size: 12px;
    font-weight: 700;

    transition: background 0.2s ease;
}

.portal-create-story a:hover {
    background: var(--primary-dark);
}


/* =========================================================
   SIDEBAR BOTTOM
   ========================================================= */

.portal-sidebar-bottom {
    padding: 13px;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-logout {
    display: flex;
    align-items: center;
    gap: 10px;

    width: 100%;

    padding: 10px 11px;

    border-radius: 9px;

    color: #999999;

    font-size: 13px;
    font-weight: 550;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.portal-logout:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--white);
}

.portal-logout svg {
    width: 17px;
    height: 17px;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

.portal-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.portal-topbar {
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 34px;

    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.portal-breadcrumb {
    color: var(--grey-500);
    font-size: 13px;
}

.portal-breadcrumb strong {
    color: var(--black);
    font-weight: 650;
}

.portal-topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.portal-notification {
    position: relative;

    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--white);
    color: var(--grey-600);
}

.portal-notification:hover {
    color: var(--black);
    background: var(--grey-50);
}

.portal-notification svg {
    width: 17px;
    height: 17px;
}

.portal-user {
    display: flex;
    align-items: center;
    gap: 9px;
}

.portal-user-avatar {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--primary-soft);
    color: var(--primary-dark);

    font-size: 12px;
    font-weight: 750;

    overflow: hidden;
}

.portal-user-avatar img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.portal-user-details strong {
    display: block;

    color: var(--black);

    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.portal-user-details span {
    display: block;

    margin-top: 2px;

    color: var(--grey-500);

    font-size: 10px;
    line-height: 1.2;
}


/* =========================================================
   PORTAL CONTENT
   ========================================================= */

.portal-content {
    width: 100%;
    max-width: 1500px;

    margin: 0 auto;

    padding: 34px;
}


/* =========================================================
   WRITER DASHBOARD
   ========================================================= */

.writer-dashboard {
    width: 100%;
}

.writer-welcome {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 25px;

    margin-bottom: 30px;
}

.writer-eyebrow {
    margin-bottom: 7px;

    color: var(--primary-dark);

    font-size: 11px;
    font-weight: 750;

    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.writer-welcome h1 {
    margin-bottom: 7px;

    color: var(--black);

    font-size: 31px;
    font-weight: 780;

    letter-spacing: -1px;
}

.writer-welcome p {
    max-width: 600px;

    color: var(--grey-500);

    font-size: 14px;
}

.writer-primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    flex: 0 0 auto;

    padding: 12px 17px;

    border-radius: 9px;

    background: var(--black);
    color: var(--white);

    font-size: 13px;
    font-weight: 700;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.writer-primary-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}


/* =========================================================
   WRITER STATS
   ========================================================= */

.writer-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;

    margin-bottom: 25px;
}

.writer-stat {
    padding: 19px;

    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-sm);
}

.writer-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 16px;
}

.writer-stat-label {
    color: var(--grey-500);

    font-size: 11px;
    font-weight: 600;
}

.writer-stat-icon {
    width: 31px;
    height: 31px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    background: var(--grey-100);
    color: var(--grey-700);
}

.writer-stat-icon svg {
    width: 15px;
    height: 15px;
}

.writer-stat-value {
    margin-bottom: 4px;

    color: var(--black);

    font-size: 23px;
    font-weight: 780;

    letter-spacing: -0.5px;
}

.writer-stat-note {
    color: var(--grey-400);
    font-size: 11px;
}


/* =========================================================
   WRITER DASHBOARD GRID
   ========================================================= */

.writer-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.9fr);
    gap: 18px;
}

.writer-panel {
    min-width: 0;

    padding: 21px;

    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-sm);
}

.writer-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 18px;
}

.writer-panel-title {
    color: var(--black);

    font-size: 15px;
    font-weight: 750;
}

.writer-panel-link {
    color: var(--primary-dark);

    font-size: 11px;
    font-weight: 700;
}

.writer-panel-link:hover {
    text-decoration: underline;
}


/* =========================================================
   STORY LIST
   ========================================================= */

.writer-story-list {
    display: flex;
    flex-direction: column;
}

.writer-story {
    display: flex;
    align-items: center;
    gap: 13px;

    padding: 13px 0;

    border-top: 1px solid var(--grey-100);
}

.writer-story:first-child {
    border-top: 0;
    padding-top: 0;
}

.writer-story:last-child {
    padding-bottom: 0;
}

.writer-story-cover {
    width: 48px;
    height: 62px;

    flex: 0 0 48px;

    border-radius: 6px;

    background: var(--grey-100);

    overflow: hidden;
}

.writer-story-cover img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.writer-story-cover-placeholder {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    background:
        linear-gradient(
            135deg,
            #f5f5f5,
            #e7e5e4
        );

    color: var(--grey-400);

    font-size: 16px;
    font-weight: 800;
}

.writer-story-info {
    min-width: 0;
    flex: 1;
}

.writer-story-info h3 {
    margin-bottom: 4px;

    color: var(--black);

    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.writer-story-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;

    color: var(--grey-400);

    font-size: 10px;
}

.writer-story-meta span + span::before {
    content: "•";
    margin-right: 7px;
}

.writer-story-price {
    color: var(--grey-700);
    font-size: 12px;
    font-weight: 700;
}

.writer-story-status {
    display: inline-flex;
    align-items: center;

    padding: 4px 7px;

    border-radius: 5px;

    font-size: 9px;
    font-weight: 750;

    text-transform: capitalize;
}

.writer-story-status.published {
    background: var(--success-soft);
    color: var(--success);
}

.writer-story-status.pending {
    background: var(--warning-soft);
    color: var(--warning);
}

.writer-story-status.draft {
    background: var(--grey-100);
    color: var(--grey-600);
}

.writer-story-status.rejected {
    background: var(--danger-soft);
    color: var(--danger);
}

.writer-story-status.archived {
    background: var(--grey-100);
    color: var(--grey-500);
}


/* =========================================================
   SALES
   ========================================================= */

.writer-sales {
    display: flex;
    flex-direction: column;
}

.writer-sale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 13px 0;

    border-top: 1px solid var(--grey-100);
}

.writer-sale:first-child {
    border-top: 0;
    padding-top: 0;
}

.writer-sale:last-child {
    padding-bottom: 0;
}

.writer-sale-info {
    min-width: 0;
}

.writer-sale-info strong {
    display: block;

    margin-bottom: 3px;

    color: var(--black);

    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.writer-sale-info span {
    color: var(--grey-400);
    font-size: 10px;
}

.writer-sale-amount {
    flex: 0 0 auto;

    color: var(--success);

    font-size: 12px;
    font-weight: 750;
}


/* =========================================================
   EMPTY STATES
   ========================================================= */

.writer-empty {
    padding: 35px 15px;

    color: var(--grey-400);

    font-size: 12px;
    text-align: center;
}

.writer-empty strong {
    display: block;

    margin-bottom: 5px;

    color: var(--grey-600);

    font-size: 13px;
}


/* =========================================================
   QUICK ACTIONS
   ========================================================= */

.writer-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.writer-action {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 12px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--white);

    color: var(--grey-700);

    font-size: 11px;
    font-weight: 650;

    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease;
}

.writer-action:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.writer-action svg {
    width: 16px;
    height: 16px;

    flex: 0 0 16px;
}


/* =========================================================
   GENERIC STATUS BADGES
   ========================================================= */

.status-badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 8px;

    border-radius: 6px;

    font-size: 10px;
    font-weight: 700;
}

.status-badge.success {
    background: var(--success-soft);
    color: var(--success);
}

.status-badge.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-badge.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.status-badge.neutral {
    background: var(--grey-100);
    color: var(--grey-600);
}


/* =========================================================
   MOBILE MENU
   ========================================================= */

.portal-mobile-header {
    display: none;
}

.portal-mobile-close {
    display: none;
}

.portal-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, 0.5);

    z-index: 999;
}

.portal-overlay.active {
    display: block;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {

    .writer-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .writer-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .portal-content {
        padding: 28px;
    }
}


@media (max-width: 800px) {

    :root {
        --sidebar-width: 250px;
    }

    .portal-sidebar {
        transform: translateX(-100%);

        transition: transform 0.25s ease;

        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.12);
    }

    .portal-sidebar.open {
        transform: translateX(0);
    }

    .portal-mobile-close {
        display: flex;
        align-items: center;
        justify-content: center;

        position: absolute;
        top: 18px;
        right: 15px;

        width: 32px;
        height: 32px;

        border: 0;
        border-radius: 8px;

        background: rgba(255, 255, 255, 0.08);
        color: var(--white);
    }

    .portal-mobile-close svg {
        width: 16px;
        height: 16px;
    }

    .portal-main {
        margin-left: 0;
    }

    .portal-topbar {
        height: 62px;

        padding: 0 18px;
    }

    .portal-content {
        padding: 22px 18px;
    }

    .portal-topbar-right {
        gap: 10px;
    }

    .portal-user-details {
        display: none;
    }

    .portal-mobile-header {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .portal-menu-button {
        width: 36px;
        height: 36px;

        display: flex;
        align-items: center;
        justify-content: center;

        border: 1px solid var(--border);
        border-radius: 9px;

        background: var(--white);
        color: var(--black);
    }

    .portal-menu-button svg {
        width: 18px;
        height: 18px;
    }

    .writer-welcome {
        align-items: flex-start;
        flex-direction: column;
    }

    .writer-primary-button {
        width: 100%;
    }

    .writer-welcome h1 {
        font-size: 27px;
    }
}


@media (max-width: 600px) {

    .auth-card {
        padding: 28px 22px;
    }

    .account-types {
        grid-template-columns: 1fr;
    }

    .writer-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .writer-stat {
        padding: 15px;
    }

    .writer-stat-value {
        font-size: 19px;
    }

    .writer-dashboard-grid {
        gap: 12px;
    }

    .writer-panel {
        padding: 17px;
    }

    .writer-actions {
        grid-template-columns: 1fr;
    }

    .portal-breadcrumb {
        font-size: 12px;
    }

    .portal-notification {
        width: 34px;
        height: 34px;
    }
}


@media (max-width: 420px) {

    .portal-content {
        padding: 18px 14px;
    }

    .writer-stats {
        grid-template-columns: 1fr;
    }

    .writer-welcome h1 {
        font-size: 24px;
    }

    .writer-welcome p {
        font-size: 13px;
    }

    .portal-topbar {
        padding: 0 14px;
    }
}