/* =========================================================
   Portal Manager - Shared Styles
   ========================================================= */

/* ---------- Base ---------- */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2933;
    line-height: 1.5;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}


/* ---------- Authentication / Login ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 600;
    color: #111827;
}

.auth-card .subtitle {
    margin: 0 0 24px;
    color: #6b7280;
    font-size: 14px;
}


/* ---------- Forms ---------- */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: #9ca3af;
}


/* ---------- Buttons ---------- */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.05s ease;
}

button:hover,
.btn:hover {
    background: #1d4ed8;
    text-decoration: none;
}

button:active,
.btn:active {
    transform: translateY(1px);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #ffffff;
    border-color: #d1d5db;
    color: #374151;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #c4c9d0;
}

.btn-danger {
    background: #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: #16a34a;
}

.btn-success:hover {
    background: #15803d;
}


/* ---------- Messages ---------- */

.message {
    padding: 11px 13px;
    margin-bottom: 18px;
    border-radius: 7px;
    font-size: 14px;
    border: 1px solid transparent;
}

.message-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.message-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.message-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.message-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}


/* ---------- Authentication helpers ---------- */

.auth-actions {
    margin-top: 22px;
}

.auth-actions button,
.auth-actions .btn {
    width: 100%;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

.code-input {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 6px;
}


/* ---------- Main Manager Layout ---------- */

.page {
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.header {
    background: #ffffff;
    border-bottom: 1px solid #e1e5e9;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.header-subtitle {
    margin: 2px 0 0;
    font-size: 13px;
    color: #6b7280;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ---------- Page headings ---------- */

.page-heading {
    margin-bottom: 24px;
}

.page-heading h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    color: #111827;
}

.page-heading p {
    margin: 6px 0 0;
    color: #6b7280;
}


/* ---------- Cards ---------- */

.card {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card:last-child {
    margin-bottom: 0;
}

.card h2 {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 600;
    color: #111827;
}

.card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.card p {
    color: #6b7280;
}


/* ---------- Grid ---------- */

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}


/* ---------- Stats ---------- */

.stat-card {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 20px;
}

.stat-label {
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    line-height: 1.2;
    font-weight: 600;
    color: #111827;
}

.stat-description {
    margin-top: 5px;
    font-size: 12px;
    color: #9ca3af;
}


/* ---------- Service / status elements ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
}

.status-online {
    color: #166534;
}

.status-online::before {
    background: #22c55e;
}

.status-offline {
    color: #991b1b;
}

.status-offline::before {
    background: #ef4444;
}

.status-warning {
    color: #92400e;
}

.status-warning::before {
    background: #f59e0b;
}


/* ---------- Tables ---------- */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

th {
    background: #f9fafb;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
}

td {
    font-size: 14px;
    color: #4b5563;
}

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


/* ---------- Action groups ---------- */

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.actions .btn,
.actions button {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 13px;
}


/* ---------- Utility classes ---------- */

.text-muted {
    color: #6b7280;
}

.text-small {
    font-size: 13px;
}

.text-center {
    text-align: center;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}


/* ---------- Responsive ---------- */

@media (max-width: 800px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .auth-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 24px;
    }

    .container {
        padding: 16px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .page-heading h1 {
        font-size: 24px;
    }

    .card {
        padding: 18px;
    }

    .flex-between {
        align-items: flex-start;
        flex-direction: column;
    }

    .actions {
        width: 100%;
    }

    .actions .btn,
    .actions button {
        flex: 1;
    }
}
