/*
|--------------------------------------------------------------------------
| Triton Stones - Admin Panel Styles
|--------------------------------------------------------------------------
| Main admin interface styles.
| Keep this file readable and centralized so the admin panel is easy to
| maintain as the CMS grows.
|--------------------------------------------------------------------------
*/

/* ==========================================================================
   1. VARIABLES
   ========================================================================== */

:root {
    --admin-black: #111311;
    --admin-ink: #171817;
    --admin-white: #ffffff;

    --admin-bg: #f5f5f2;
    --admin-card: #ffffff;

    --admin-green: #305348;
    --admin-green-dark: #203c33;

    --admin-gold: #e8b236;

    --admin-muted: #6c706d;
    --admin-border: #e4e5e1;
    --admin-border-dark: #d5d7d3;

    --admin-danger: #a43a3a;

    --admin-sidebar-width: 260px;
}


/* ==========================================================================
   2. RESET
   ========================================================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    color: var(--admin-ink);
    background: var(--admin-bg);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font-family: inherit;
}


/* ==========================================================================
   3. MAIN ADMIN LAYOUT
   ========================================================================== */

.admin-layout {
    display: flex;
    min-height: 100vh;
}


/* ==========================================================================
   4. SIDEBAR
   ========================================================================== */

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    z-index: 1000;

    display: flex;
    flex-direction: column;

    width: var(--admin-sidebar-width);
    min-width: var(--admin-sidebar-width);
    height: 100vh;

    padding: 22px 16px;

    color: #c7c7c7;
    background: var(--admin-black);

    overflow: hidden;
}


/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */

.admin-logo {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    gap: 12px;

    min-height: 42px;
    margin-bottom: 22px;

    padding: 0 4px;
}

.admin-logo span {
    display: grid;

    flex: 0 0 38px;

    width: 38px;
    height: 38px;

    place-items: center;

    color: #ffffff;
    background: var(--admin-gold);

    font-size: 15px;
    font-weight: 700;
}

.admin-logo strong {
    color: #ffffff;
    font-size: 15px;
    line-height: 1.2;
}


/* --------------------------------------------------------------------------
   Sidebar Navigation
   -------------------------------------------------------------------------- */

.admin-nav {
    flex: 1;

    min-height: 0;

    padding-right: 3px;

    overflow-y: auto;
    overflow-x: hidden;

    scrollbar-width: thin;
    scrollbar-color: #363936 transparent;
}


/*
 * Important:
 * Every menu item has its own fixed line-height and enough height.
 * This prevents text and icons from overlapping.
 */

.admin-sidebar nav {
    display: flex;
    flex-direction: column;

    width: 100%;

    gap: 3px;
}

.admin-sidebar nav a,
.admin-sidebar-bottom a {
    display: flex;
    align-items: center;

    width: 100%;
    min-height: 43px;

    margin: 0;
    padding: 10px 12px;

    color: #c7c7c7;

    border-radius: 6px;

    font-size: 13px;
    line-height: 1.35;

    white-space: nowrap;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}


/*
 * If an icon exists inside the menu item, prevent it from shrinking.
 */

.admin-sidebar nav a i,
.admin-sidebar nav a svg,
.admin-sidebar nav a .icon {
    flex: 0 0 auto;

    width: 18px;
    min-width: 18px;

    margin-right: 10px;
}


/*
 * Text inside a menu item must be allowed to shrink instead of
 * overflowing into the next item.
 */

.admin-sidebar nav a span,
.admin-sidebar nav a .nav-text {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.admin-sidebar nav a:hover,
.admin-sidebar-bottom a:hover {
    color: #ffffff;
    background: #252825;
}


.admin-sidebar nav a.active {
    color: #ffffff;
    background: var(--admin-green);
}


/* --------------------------------------------------------------------------
   Navigation Section Labels
   -------------------------------------------------------------------------- */

.admin-nav .nav-label {
    display: block;

    margin-top: 18px;
    margin-bottom: 6px;

    padding: 0 12px;

    color: #7f8781;

    font-size: 10px;
    line-height: 1.4;
    font-weight: 700;

    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-nav .nav-label:first-child {
    margin-top: 0;
}


/* --------------------------------------------------------------------------
   Sidebar Bottom
   -------------------------------------------------------------------------- */

/*
 * IMPORTANT:
 * Do NOT use position:absolute here.
 *
 * Absolute positioning was one of the reasons long menus could overlap
 * the bottom links.
 */

.admin-sidebar-bottom {
    flex-shrink: 0;

    width: 100%;

    margin-top: 14px;
    padding-top: 14px;

    border-top: 1px solid #292c29;
}

.admin-sidebar-bottom a {
    margin-bottom: 3px;
}

.admin-sidebar-bottom a:last-child {
    margin-bottom: 0;
}


/* ==========================================================================
   5. MAIN CONTENT
   ========================================================================== */

.admin-main {
    width: calc(100% - var(--admin-sidebar-width));
    min-width: 0;

    margin-left: var(--admin-sidebar-width);
}


/* ==========================================================================
   6. TOP BAR
   ========================================================================== */

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 74px;

    gap: 20px;

    padding: 18px 30px;

    background: var(--admin-white);

    border-bottom: 1px solid var(--admin-border);
}

.admin-topbar .eyebrow,
.eyebrow {
    display: block;

    margin-bottom: 4px;

    color: var(--admin-gold);

    font-size: 10px;
    line-height: 1.3;
    font-weight: 800;

    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-user {
    color: var(--admin-muted);

    font-size: 13px;
}


/* ==========================================================================
   7. PAGE CONTENT
   ========================================================================== */

.admin-content {
    width: 100%;
    max-width: 1450px;

    margin: 0 auto;

    padding: 30px;
}


/* ==========================================================================
   8. PAGE HEADING
   ========================================================================== */

.admin-page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;
}

.admin-page-heading h1 {
    margin: 0 0 5px;

    color: var(--admin-ink);

    font-size: 28px;
    line-height: 1.2;
}


/* ==========================================================================
   9. BUTTONS
   ========================================================================== */

.admin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 42px;

    padding: 10px 17px;

    color: #ffffff;
    background: var(--admin-black);

    border: 1px solid var(--admin-black);

    cursor: pointer;

    font-size: 13px;
    line-height: 1.2;

    text-decoration: none;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.admin-button:hover {
    background: #252525;
}

.admin-button.green {
    color: #ffffff;

    background: var(--admin-green);
    border-color: var(--admin-green);
}

.admin-button.green:hover {
    background: var(--admin-green-dark);
    border-color: var(--admin-green-dark);
}


/* ==========================================================================
   10. DASHBOARD STATISTICS
   ========================================================================== */

.admin-stat-grid {
    display: grid;

    grid-template-columns: repeat(6, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 20px;
}

.admin-stat-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-stat {
    display: block;

    min-width: 0;

    padding: 18px;

    color: inherit;
    background: var(--admin-card);

    border: 1px solid var(--admin-border);
    border-radius: 12px;

    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
}

.admin-stat span {
    display: block;

    margin-bottom: 12px;

    color: var(--admin-muted);

    font-size: 12px;
}

.admin-stat strong {
    display: block;

    font-size: 28px;
    line-height: 1.1;
}


/* ==========================================================================
   11. CARDS
   ========================================================================== */

.admin-card-grid {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 18px;
}

.admin-card {
    min-width: 0;

    margin-bottom: 18px;
    padding: 20px;

    background: var(--admin-card);

    border: 1px solid var(--admin-border);
    border-radius: 12px;
}

.card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 16px;
}

.card-heading h2 {
    margin: 0;

    font-size: 17px;
    line-height: 1.3;
}

.card-heading a {
    color: var(--admin-green);

    font-size: 12px;
}


/* ==========================================================================
   12. QUICK LINKS
   ========================================================================== */

.quick-links {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 10px;
}

.quick-links a {
    display: block;

    min-width: 0;

    padding: 13px;

    color: inherit;
    background: #fafaf8;

    border: 1px solid var(--admin-border);
    border-radius: 8px;
}

.quick-links a:hover {
    border-color: var(--admin-gold);
}


/* ==========================================================================
   13. COMPACT LIST
   ========================================================================== */

.compact-list > div {
    display: flex;
    justify-content: space-between;

    gap: 20px;

    padding: 12px 0;

    border-bottom: 1px solid var(--admin-border);
}

.compact-list > div:last-child {
    border-bottom: 0;
}

.compact-list span {
    color: var(--admin-muted);

    font-size: 12px;

    text-align: right;
}

.muted {
    color: var(--admin-muted);
}


/* ==========================================================================
   14. TABLES
   ========================================================================== */

.admin-table-wrap {
    width: 100%;

    overflow-x: auto;

    background: #ffffff;

    border: 1px solid var(--admin-border);
}

.admin-table {
    width: 100%;

    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 14px;

    text-align: left;
    vertical-align: top;

    border-bottom: 1px solid var(--admin-border);
}

.admin-table th {
    color: #555555;
    background: #fafafa;

    font-size: 11px;
    font-weight: 700;

    text-transform: uppercase;
    white-space: nowrap;
}

.admin-table td {
    line-height: 1.5;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;
}


/* ==========================================================================
   15. TOOLBAR
   ========================================================================== */

.admin-toolbar {
    display: flex;
    justify-content: flex-end;

    gap: 10px;

    margin-bottom: 14px;
}

.admin-toolbar input {
    width: 100%;
    max-width: 320px;
}


/* ==========================================================================
   16. FORMS
   ========================================================================== */

.admin-form {
    width: 100%;
    max-width: 1000px;

    padding: 28px;

    background: #ffffff;

    border: 1px solid var(--admin-border);
    border-radius: 10px;
}

.admin-form-grid {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 20px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;

    min-width: 0;

    gap: 7px;
}

.admin-form-group.full {
    grid-column: 1 / -1;
}

.admin-form-group label {
    color: var(--admin-ink);

    font-size: 13px;
    font-weight: 700;
}

.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
    width: 100%;
    max-width: 100%;

    padding: 12px;

    color: var(--admin-ink);
    background: #ffffff;

    border: 1px solid #cccccc;
    border-radius: 4px;

    font-size: 14px;
}

.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
    outline: none;

    border-color: var(--admin-green);

    box-shadow: 0 0 0 2px rgba(48, 83, 72, 0.08);
}

.admin-form-group textarea {
    min-height: 160px;

    resize: vertical;
}

.admin-form small {
    display: block;

    margin-top: 6px;

    color: var(--admin-muted);

    font-size: 11px;
    line-height: 1.5;
}

.form-section {
    margin-bottom: 18px;
}

.form-actions {
    display: flex;
    align-items: center;

    gap: 10px;

    margin: 20px 0;
}


/* ==========================================================================
   17. CODE EDITORS
   ========================================================================== */

.code-field,
.large-editor {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    line-height: 1.55;
}

.code-field {
    color: #e8ece8;

    background: #181a18;

    border-color: #181a18;
}

.large-editor {
    min-height: 260px;
}


/* ==========================================================================
   18. ALERTS
   ========================================================================== */

.admin-alert {
    margin-bottom: 20px;

    padding: 13px 16px;

    background: #ffffff;

    border-left: 4px solid var(--admin-gold);
}

.admin-alert.error {
    border-left-color: var(--admin-danger);
}

.admin-alert.success {
    border-left-color: var(--admin-green);
}


/* ==========================================================================
   19. IMAGE / MEDIA
   ========================================================================== */

.current-image {
    display: flex;
    align-items: center;

    gap: 12px;

    margin-top: 15px;
    padding: 12px;

    border: 1px solid var(--admin-border);
    border-radius: 8px;
}

.current-image img {
    flex: 0 0 auto;

    width: 90px;
    height: 70px;

    object-fit: cover;

    border-radius: 6px;
}

.current-image span {
    min-width: 0;

    color: var(--admin-muted);

    font-size: 12px;

    overflow-wrap: anywhere;
}


.gallery-preview {
    display: grid;

    grid-template-columns: repeat(5, minmax(0, 1fr));

    gap: 10px;

    margin-top: 15px;
}

.gallery-preview > div {
    min-width: 0;

    padding: 7px;

    background: #fafaf8;

    border: 1px solid var(--admin-border);
    border-radius: 8px;
}

.gallery-preview img {
    display: block;

    width: 100%;
    height: 110px;

    object-fit: cover;

    border-radius: 5px;
}

.gallery-preview small {
    display: block;

    margin-top: 6px;

    color: var(--admin-muted);

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================================
   20. MEDIA LIBRARY
   ========================================================================== */

.media-grid {
    display: grid;

    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 16px;
}

.media-card {
    min-width: 0;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid var(--admin-border);
    border-radius: 10px;
}

.media-thumb {
    height: 190px;

    background: #eceeea;
}

.media-thumb img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.media-info {
    min-width: 0;

    padding: 13px;
}

.media-info strong,
.media-info small {
    display: block;
}

.media-info strong {
    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-info small {
    margin: 5px 0 10px;

    color: var(--admin-muted);

    font-size: 10px;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-info input {
    width: 100%;

    margin-bottom: 10px;

    font-size: 10px;
}


/* ==========================================================================
   21. MENU MANAGER
   ========================================================================== */

.menu-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 1fr)
        auto;

    align-items: center;

    gap: 10px;

    margin-bottom: 10px;
}

.menu-row input {
    min-width: 0;
}


/* ==========================================================================
   22. RESPONSIVE - TABLET
   ========================================================================== */

@media (max-width: 1200px) {

    :root {
        --admin-sidebar-width: 240px;
    }

    .admin-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .media-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


/* ==========================================================================
   23. RESPONSIVE - SMALL TABLET
   ========================================================================== */

@media (max-width: 900px) {

    :root {
        --admin-sidebar-width: 220px;
    }

    .admin-content {
        padding: 24px;
    }

    .admin-topbar {
        padding: 16px 24px;
    }

    .admin-card-grid {
        grid-template-columns: 1fr;
    }

    .admin-stat-grid,
    .admin-stat-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-preview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .admin-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}


/* ==========================================================================
   24. RESPONSIVE - MOBILE
   ========================================================================== */

@media (max-width: 700px) {

    /*
     * On mobile the sidebar becomes part of normal document flow.
     * This prevents it from covering the content.
     */

    .admin-sidebar {
        position: static;

        width: 100%;
        min-width: 0;
        height: auto;

        max-height: none;

        overflow: visible;

        padding: 18px;
    }

    .admin-nav {
        overflow: visible;
    }

    .admin-sidebar-bottom {
        margin-top: 15px;
    }

    .admin-layout {
        display: block;
    }

    .admin-main {
        width: 100%;

        margin-left: 0;
    }

    .admin-topbar {
        flex-wrap: wrap;

        min-height: auto;

        padding: 15px 18px;
    }

    .admin-content {
        padding: 18px;
    }

    .admin-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-page-heading h1 {
        font-size: 24px;
    }

    .admin-form-grid {
        grid-template-columns: 1fr;
    }

    .admin-form-group.full {
        grid-column: auto;
    }

    .admin-stat-grid,
    .admin-stat-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery-preview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .menu-row {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   25. RESPONSIVE - SMALL MOBILE
   ========================================================================== */

@media (max-width: 520px) {

    .admin-content {
        padding: 15px;
    }

    .admin-stat-grid,
    .admin-stat-grid.compact {
        grid-template-columns: 1fr;
    }

    .media-grid {
        grid-template-columns: 1fr;
    }

    .gallery-preview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-form {
        padding: 20px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px;
    }
}