/* ==========================================
   braina — Global
========================================== */

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

:root {
    --primary: #16b5ff;
    --primary-dark: #0b8fe5;
    --primary-light: #4fd2ff;

    --bg: #f5f8fc;
    --surface: #ffffff;
    --border: #e7edf4;

    --text: #1d2939;
    --text-light: #667085;
    --text-muted: #98a2b3;

    --success: #32d583;
    --warning: #f7b500;
    --danger: #ef4444;

    --shadow: 0 8px 30px rgba(16,24,40,.08);

    --radius: 18px;
    --radius-sm: 12px;
    --transition: .25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

button {
    cursor: pointer;
    border: none;
    outline: none;
    font: inherit;
}

code {
    background: var(--bg);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

/* ==========================================
   Main layout
========================================== */

.app {
    display: grid;
    grid-template-columns: 80px 260px 1fr 280px;
    min-height: 100vh;
}

/* Grid tracks default to min-width:auto, which lets long content overflow
   its section; allow every column to shrink instead. */
.app > * {
    min-width: 0;
}

/* ==========================================
   Icon sidebar
========================================== */

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
}

.logo {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 20px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar nav a {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7b8794;
    transition: var(--transition);
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: #eef8ff;
    color: var(--primary);
}

.sidebar nav a svg {
    width: 22px;
    height: 22px;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sidebar-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7b8794;
    background: none;
    transition: var(--transition);
}

.sidebar-icon:hover {
    background: #eef8ff;
    color: var(--primary);
}

.sidebar-icon svg {
    width: 22px;
    height: 22px;
}

.sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: var(--transition);
}

.sidebar-avatar:hover {
    transform: scale(1.06);
}

/* ==========================================
   Blue status panel
========================================== */

.panel {
    background: linear-gradient(180deg, #24b7ff 0%, #1298eb 100%);
    color: #fff;
    padding: 28px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.new-btn {
    background: #fff;
    color: var(--primary);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.new-btn:hover {
    transform: translateY(-2px);
}

.progress-card {
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 30px;
    overflow-wrap: anywhere;
}

.progress-card h1 {
    font-size: 22px;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.progress-card p {
    opacity: .85;
    font-size: 13px;
}

.panel-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel-item {
    background: rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 18px;
    transition: var(--transition);
    display: block;
    overflow-wrap: anywhere;
}

.panel-item:hover {
    background: rgba(255,255,255,.2);
    transform: translateY(-3px);
}

.panel-item h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.panel-item p {
    opacity: .8;
    font-size: 13px;
}

.panel-item small {
    display: block;
    margin-top: 12px;
    opacity: .75;
}

/* ==========================================
   Main content
========================================== */

.content {
    padding: 40px;
    background: var(--surface);
}

.page-title {
    font-size: 34px;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    align-items: start;
}

/* ==========================================
   Cards
========================================== */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 30px;
    /* Wide content (tables) scrolls inside the card instead of breaking the
       section layout. */
    overflow-x: auto;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 14px;
}

.small-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 12px 0;
}

.card-hover {
    transition: var(--transition);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(0,0,0,.08);
}

/* ==========================================
   Buttons
========================================== */

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-light {
    background: var(--bg);
    color: var(--text);
}

.btn-light:hover {
    background: #eef8ff;
    color: var(--primary);
}

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.crud-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

/* ==========================================
   Tables
========================================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    color: var(--text-light);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    overflow-wrap: anywhere;
}

tr:last-child td {
    border-bottom: none;
}

td small {
    color: var(--text-light);
}

td form {
    align-items: center;
    flex-wrap: wrap;
}

td input,
td select {
    max-width: 220px;
}

/* ==========================================
   Forms
========================================== */

form p {
    margin-bottom: 16px;
}

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,181,255,.15);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.helptext {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.errorlist {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 6px;
    list-style: none;
}

/* ==========================================
   Badges & messages
========================================== */

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--border);
    color: var(--text-light);
}

.badge.active {
    background: var(--success);
    color: #fff;
}

.messages {
    list-style: none;
    margin-bottom: 18px;
}

.messages li {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 14px;
}

.messages li.success {
    border-left: 4px solid var(--success);
}

.messages li.error {
    border-left: 4px solid var(--danger);
}

.error {
    color: var(--danger);
}

/* ==========================================
   Modals
========================================== */

dialog.modal {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 15px 40px rgba(16,24,40,.18);
    padding: 28px;
    max-width: 440px;
    width: calc(100% - 40px);
}

dialog.modal::backdrop {
    background: rgba(16,24,40,.4);
}

dialog.modal h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

dialog.modal .helptext {
    margin-bottom: 16px;
}

/* ==========================================
   Right sidebar
========================================== */

.right-panel {
    background: #fbfcfe;
    border-left: 1px solid var(--border);
    padding: 30px;
}

.profile {
    text-align: center;
    margin-bottom: 40px;
}

.profile .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 30px;
}

.profile h3 {
    margin-bottom: 5px;
}

.profile p {
    color: var(--text-light);
    font-size: 14px;
}

.profile .profile-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.profile .profile-actions .btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
}

.timeline {
    margin: 40px 0;
}

.timeline h4 {
    font-size: 16px;
    margin-bottom: 20px;
}

.timeline-item {
    position: relative;
    padding-left: 26px;
    margin-bottom: 22px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 4px;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
}

.timeline-item::after {
    content: "";
    position: absolute;
    left: 10px;
    top: 14px;
    width: 2px;
    height: 44px;
    background: #d9e4ef;
}

.timeline-item:last-child::after {
    display: none;
}

.timeline-item h5 {
    margin-bottom: 4px;
}

.timeline-item p {
    color: var(--text-light);
    font-size: 13px;
}

/* ==========================================
   Scrollbar
========================================== */

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ==========================================
   Responsive
========================================== */

@media (max-width: 1200px) {

    .app {
        grid-template-columns: 80px 240px 1fr;
    }

    .right-panel {
        display: none;
    }
}

@media (max-width: 900px) {

    .app {
        grid-template-columns: 80px 1fr;
    }

    .panel {
        display: none;
    }

    .content {
        padding: 24px;
    }
}

@media (max-width: 600px) {

    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .content {
        padding: 20px;
    }

    .page-title {
        font-size: 28px;
    }
}
