@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600&display=swap');

:root {
    --blue-bg: #33CCFF;          /* Waze Blue */
    --blue-soft: #CAF8FF;        /* Blue 50 */
    --blue-soft-strong: #98E9FF; /* Blue 100 */

    --waze-green: #1EE592;       /* Waze Green */
    --waze-orange: #FF804B;      /* Waze Orange */
    --waze-red: #FF5252;         /* Waze Red */
    --waze-yellow: #FCE354;      /* Waze Yellow */

    --gray-bg: #F8F9FA;          /* Gray 50 */
    --gray-border: #E8EAED;      /* Gray 200 */

    --card-bg: #ffffff;
    --text-main: #202124;        /* Gray 900 */
    --text-muted: #72767D;       /* Gray 600 */

    --accent: var(--waze-orange);

    --radius-xl: 24px;
    --radius-md: 12px;
    --shadow-soft: 0 16px 30px rgba(0,0,0,0.15);
    --shadow-light: 0 2px 6px rgba(0,0,0,0.12);
    --font-main: Rubik, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

/* body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font-main);
    background: linear-gradient(180deg, #98E9FF45 0%, #33CCFF45 55%, #1EE59245 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: stretch;
} */

body {
    margin: 0;
    min-height: 100dvh;

    background:
        linear-gradient(180deg, #98E9FF45 0%, #33CCFF45 55%, #1EE59245 100%);
    background-clip: border-box;

    padding: env(safe-area-inset-top)
             env(safe-area-inset-right)
             env(safe-area-inset-bottom)
             env(safe-area-inset-left);

    font-family: var(--font-main);
    color: var(--text-main);

    display: flex;
    justify-content: center;
    align-items: stretch;
}

.shell {
    width: 100%;
    max-width: 520px;
    margin: 16px auto;
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.admin-panel-open .shell {
    max-width: none;
}

.stack-panel {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 24px 20px;
    background: var(--card-bg);
    position: relative;
    overflow: hidden;
}

.panel-header {
    background: var(--blue-bg);
    color: #fff;
    padding-bottom: 15px;
    overflow: visible;
}

.panel-links {
    background: var(--waze-green);
    color: #0d402f;
    padding-bottom: 50px;
    overflow: visible;
}

.panel-footer {
    background: var(--waze-yellow);
    color: #4d2e00;
    padding-bottom: 25px;
    overflow: visible;
}

.panel-admin {
    background: var(--waze-orange);
    color: #fff;
}

.panel-header h1,
.panel-header .subtitle,
.panel-header .tagline {
    color: #fff;
}

.panel-header .header-icon {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.mood-waze {
    position: absolute;
    left: 55px;
    bottom: -15.5px;
    height: 90px;
    pointer-events: none;
}

.mood-carpool {
    position: absolute;
    right: 30px;
    bottom: -15.5px;
    height: 90px;
    pointer-events: none;
}

.mood-about {
    position: absolute;
    left: 8px;
    bottom: -5px;
    height: 60px;
    pointer-events: none;
}

@media (max-width: 520px) {

    .mood-waze {
        left: 8px;
        width: 120px;
    }

    .mood-carpool {
        right: 12px;
        height: 90px;
    }

    .mood-about {
        right: 12px;
        height: 80px;
    }

    .panel-links {
        padding-bottom: 90px;
    }

    .panel-footer {
        padding-bottom: 80px;
    }
}

header {
    text-align: center;
    margin-bottom: 18px;
}

.header-links {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: var(--card-bg);
    box-shadow: var(--shadow-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    text-decoration: none;
    transition: transform 0.15s ease;
}

.header-icon:hover,
.header-icon:focus-visible {
    transform: translateY(-2px);
}

.header-icon-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.25rem;
}

.header-icon-inner svg {
    width: 28px;
    height: 28px;
    display: block;
}

.logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 10px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-light);
}

.logo img {
    width: 100%;
    height: auto;
    display: block;
}

h1 {
    font-size: 2rem;
    margin: 0 0 4px;
    letter-spacing: 0.04em;
}

.subtitle {
    font-size: 0.9rem;
    color: #f8f8f8;
    margin-bottom: 6px;
}

.tagline {
    font-size: 0.85rem;
    color: #fdfdfd;
    opacity: 0.9;
}

.links {
    margin: 0;
}

.link-item {
    display: block;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-light);
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.link-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.link-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: var(--gray-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    color: var(--text-main);
}

.link-icon svg,
.header-icon-inner svg {
    fill: currentColor;
}

.link-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.link-icon img,
.header-icon-inner img {
    width: 22px;
    height: auto;
    display: block;
}

.link-text {
    min-width: 0;
}

.link-title {
    font-size: 0.98rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.link-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.link-chevron {
    font-size: 1.1rem;
    opacity: 0.4;
    flex-shrink: 0;
}

.footer-note {
    margin: 0;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
}

.admin-pill {
    position: absolute;
    top: 12px;
    left: 18px;
    font-size: 0.7rem;
    background: var(--waze-red);
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    z-index: 2;
}

.admin-toggle {
    position: absolute;
    top: 10px;
    right: 18px;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.95);
    border-radius: 999px;
    padding: 3px 8px;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.admin-toggle span {
    font-size: 0.76rem;
}

.admin-panel {
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    font-size: 0.85rem;
}

.site-config-form {
    margin-bottom: 18px;
    display: grid;
    gap: 10px;
}

.site-config-form h3 {
    margin: 0 0 6px;
    font-size: 0.9rem;
}

.site-config-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
    margin-top: 10px;
}

.admin-panel h2 {
    margin: 0 0 8px;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-small {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}

.admin-table th,
.admin-table td {
    padding: 4px 3px;
    vertical-align: top;
}

.admin-table input[type="text"],
.admin-table input[type="url"] {
    width: 100%;
    font-size: 0.76rem;
    padding: 3px 4px;
}

.admin-table .icon-select {
    width: 130px;
}

.admin-table input[type="number"] {
    width: 50px;
    font-size: 0.76rem;
}

.order-input {
    display: none;
}

.order-cell {
    width: 70px;
}

.order-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.order-btn {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    border: 1px solid var(--gray-border);
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
}

.order-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.order-index {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.emoji-input {
    width: 50px !important;
    text-align: center;
    font-size: 0.76rem;
}

.emoji-input:read-only {
    opacity: 0.5;
    background: rgba(0,0,0,0.03);
    cursor: default;
}

.admin-table thead {
    border-bottom: 1px solid var(--gray-border);
}

.admin-row {
    border-bottom: 1px solid var(--gray-border);
}

.admin-btn-row {
    text-align: right;
    margin-top: 8px;
}

.btn-primary {
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.8rem;
    cursor: pointer;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--gray-border);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.75rem;
    cursor: pointer;
}

.panel-admin .admin-panel,
.panel-admin .login-panel {
    color: inherit;
}

.panel-admin .admin-panel h2 {
    margin-top: 0;
}

.panel-admin .admin-small {
    color: rgba(255,255,255,0.85);
}

.panel-admin .admin-table th,
.panel-admin .admin-table td {
    color: #fff;
    text-align: center;
}

.panel-admin .order-btn {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.45);
    color: #fff;
}

.panel-admin .order-index {
    color: rgba(255,255,255,0.85);
}

.panel-admin .emoji-input {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.45);
    color: #fff;
}

.panel-admin .emoji-input:read-only {
    background: rgba(255,255,255,0.1);
    opacity: 0.7;
}

.panel-admin .admin-table thead,
.panel-admin .admin-row {
    border-color: rgba(255,255,255,0.35);
}

.panel-admin input[type="text"],
.panel-admin input[type="url"],
.panel-admin input[type="password"],
.panel-admin input[type="number"],
.panel-admin textarea,
.panel-admin select {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.45);
    color: #fff;
    border-radius: 10px;
    padding: 8px;
}

.panel-admin textarea {
    min-height: 80px;
    resize: vertical;
}

.panel-admin input::placeholder,
.panel-admin select::placeholder {
    color: rgba(255,255,255,0.85);
}

.panel-admin select {
    appearance: none;
    padding: 6px 24px 6px 8px;
    background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%);
    background-position: calc(100% - 12px) calc(50% - 2px), calc(100% - 6px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.panel-admin .btn-primary {
    background: #fff;
    color: var(--waze-orange);
}

.panel-admin .btn-secondary {
    border-color: #fff;
    color: #fff;
}

.panel-admin .error {
    color: #fff;
}

.login-panel {
    margin: 0;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    font-size: 0.85rem;
}

.login-panel input[type="password"] {
    width: 100%;
    padding: 6px 7px;
    margin-top: 4px;
    font-size: 0.85rem;
}

.login-panel button {
    margin-top: 8px;
}

.error {
    color: #c00;
    font-size: 0.74rem;
    margin-top: 4px;
}

.clicks-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
}

@media (min-width: 720px) {
    body {
        align-items: center;
    }
}
