/**
 * SpediFriuli - Stile SAP Fiori / SAP GUI
 * Barra blu, menu laterale, aspetto enterprise
 */

:root {
    --sap-blue: #0a6ed1;
    --sap-blue-dark: #0854a0;
    --sap-blue-light: #d4e8f7;
    --sap-sidebar-bg: #0a6ed1;
    --sap-sidebar-hover: #0854a0;
    --sap-topbar-bg: #0a6ed1;
    --sap-content-bg: #f7f7f7;
    --sap-panel-bg: #ffffff;
    --sap-border: #d9d9d9;
    --sap-text: #32363a;
    --sap-text-muted: #6a6d70;
    --sap-font: "72", "72full", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--sap-font);
    font-size: 14px;
    color: var(--sap-text);
    background: var(--sap-content-bg);
}

/* ========== Login page ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a6ed1 0%, #0854a0 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--sap-panel-bg);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.logo-sap {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: var(--sap-blue);
    border-radius: 4px;
}

.login-header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 600;
    color: var(--sap-text);
}

.login-header p {
    margin: 0;
    font-size: 13px;
    color: var(--sap-text-muted);
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--sap-text);
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--sap-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: var(--sap-blue);
    box-shadow: 0 0 0 2px var(--sap-blue-light);
}

.message {
    padding: 10px 12px;
    margin-bottom: 16px;
    border-radius: 4px;
    font-size: 13px;
}

.message-error {
    background: #ffebeb;
    color: #b00;
    border: 1px solid #f5c2c2;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

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

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

.btn-block {
    width: 100%;
}

/* ========== Layout SAP (dashboard) ========== */
.sap-layout {
    min-height: 100vh;
    display: grid;
    grid-template-areas: "topbar topbar" "sidebar content";
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 48px 1fr;
}

.sap-topbar {
    grid-area: topbar;
    background: var(--sap-topbar-bg);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.sap-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    padding: 8px 12px;
    cursor: pointer;
    margin-right: 8px;
}

.sap-topbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.sap-logo-mini {
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.25);
    border-radius: 4px;
}

.sap-topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.sap-user {
    font-size: 13px;
    opacity: 0.95;
}

.sap-btn-exit {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
}

.sap-btn-exit:hover {
    background: rgba(255,255,255,0.15);
}

/* Sidebar */
.sap-sidebar {
    grid-area: sidebar;
    background: var(--sap-sidebar-bg);
    color: #fff;
    min-height: calc(100vh - 48px);
    box-shadow: 2px 0 6px rgba(0,0,0,0.1);
}

.sap-nav ul {
    list-style: none;
    margin: 0;
    padding: 12px 0;
}

.sap-nav li {
    margin: 0;
}

.sap-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.sap-nav a:hover {
    background: var(--sap-sidebar-hover);
    color: #fff;
}

.sap-nav li.active a {
    background: var(--sap-sidebar-hover);
    color: #fff;
    font-weight: 500;
    border-left: 3px solid #fff;
    padding-left: 17px;
}

.sap-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Content area */
.sap-content {
    grid-area: content;
    padding: 24px;
    overflow: auto;
}

.sap-toolbar {
    margin-bottom: 16px;
}

.sap-toolbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--sap-text);
}

.sap-panel {
    background: var(--sap-panel-bg);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 24px;
    border: 1px solid var(--sap-border);
}

.sap-panel p {
    margin: 0 0 12px;
    color: var(--sap-text);
}

.sap-panel p:last-child {
    margin-bottom: 0;
}

/* Form in dashboard */
.upload-form .form-group {
    margin-bottom: 16px;
}

.upload-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.upload-form input[type="file"] {
    padding: 8px 0;
}

.upload-form .btn {
    margin-top: 8px;
}

.upload-result {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 13px;
}

.upload-result.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.upload-result.error {
    background: #ffebee;
    color: #c62828;
}

/* Table SAP-style */
.sap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sap-table th,
.sap-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--sap-border);
}

.sap-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: var(--sap-text);
}

.sap-table tbody tr:hover {
    background: #fafafa;
}

.sap-table .cliente-username {
    font-size: 12px;
    color: var(--sap-text-muted);
    font-weight: normal;
}

/* Responsive: menu laterale collassabile */
@media (max-width: 768px) {
    .sap-layout {
        grid-template-areas: "topbar" "content";
        grid-template-columns: 1fr;
    }

    .sap-menu-toggle {
        display: block;
    }

    .sap-sidebar {
        position: fixed;
        left: 0;
        top: 48px;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        min-height: auto;
    }

    .sap-sidebar.open {
        transform: translateX(0);
    }

    .sap-content {
        padding: 16px;
    }
}
