/**
 * Hamza Client Portal — Frontend Styles
 *
 * @package HamzaClientPortal
 */

/* ─────────────────────────────────
 * Variables (inherit from theme where available)
 * ───────────────────────────────── */
:root {
    --hp-primary:   #E67E22;
    --hp-primary-dark: #CF6D17;
    --hp-dark:      #2C3E50;
    --hp-text:      #333333;
    --hp-muted:     #7f8c8d;
    --hp-border:    #e0e0e0;
    --hp-bg:        #f7f8fa;
    --hp-white:     #ffffff;
    --hp-radius:    8px;
    --hp-shadow:    0 2px 12px rgba(0,0,0,0.08);

    /* Status colours */
    --hp-status-aperta:             #3498DB;
    --hp-status-documenti-ricevuti: #9B59B6;
    --hp-status-in-lavorazione:     #F39C12;
    --hp-status-inviata:            #E67E22;
    --hp-status-in-attesa:          #E74C3C;
    --hp-status-completata:         #27AE60;
}

/* ─────────────────────────────────
 * Reset / base
 * ───────────────────────────────── */
.hamza-portal-wrap,
.hamza-auth-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--hp-text);
    line-height: 1.6;
    box-sizing: border-box;
}
.hamza-portal-wrap *, .hamza-auth-wrap * {
    box-sizing: border-box;
}

/* ─────────────────────────────────
 * Auth Card (Login / Register)
 * ───────────────────────────────── */
.hamza-auth-wrap {
    display: flex;
    justify-content: center;
    padding: 40px 16px;
}
.hamza-auth-card {
    background: var(--hp-white);
    border-radius: var(--hp-radius);
    box-shadow: var(--hp-shadow);
    padding: 40px 36px;
    max-width: 480px;
    width: 100%;
}
.hamza-auth-header {
    text-align: center;
    margin-bottom: 28px;
}
.hamza-auth-header h2 {
    margin: 0 0 6px;
    font-size: 24px;
    color: var(--hp-dark);
}
.hamza-auth-header p {
    margin: 0;
    color: var(--hp-muted);
    font-size: 14px;
}
.hamza-auth-switch {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
}
.hamza-auth-switch a {
    color: var(--hp-primary);
    text-decoration: none;
    font-weight: 600;
}
.hamza-auth-switch a:hover {
    text-decoration: underline;
}

/* ─────────────────────────────────
 * Notices / Errors
 * ───────────────────────────────── */
.hamza-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}
.hamza-notice-error {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}
.hamza-notice-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.hamza-auth-error {
    background: #fdecea;
    color: #c0392b;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* ─────────────────────────────────
 * Forms
 * ───────────────────────────────── */
.hamza-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--hp-dark);
}
.hamza-form label .required {
    color: #E74C3C;
}
.hamza-form label .optional {
    color: var(--hp-muted);
    font-weight: 400;
    font-size: 12px;
}
.hamza-form input[type="text"],
.hamza-form input[type="email"],
.hamza-form input[type="password"],
.hamza-form input[type="tel"],
.hamza-form input[type="number"],
.hamza-form select,
.hamza-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--hp-border);
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--hp-white);
    color: var(--hp-text);
}
.hamza-form input:focus,
.hamza-form select:focus,
.hamza-form textarea:focus {
    outline: none;
    border-color: var(--hp-primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15);
}
.hamza-form input[readonly] {
    background: #f5f5f5;
    color: var(--hp-muted);
}
.hamza-form-group {
    margin-bottom: 18px;
    flex: 1;
}
.hamza-form-row {
    display: flex;
    gap: 16px;
}
.hamza-form-row .hamza-col-2 {
    flex: 2;
}
.hamza-form-inline {
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.hamza-checkbox-label {
    font-weight: 400 !important;
    font-size: 14px !important;
    display: flex !important;
    align-items: center;
    gap: 6px;
}
.hamza-checkbox-group label {
    font-weight: 400;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.hamza-checkbox-group input[type="checkbox"] {
    margin-top: 3px;
    width: auto;
}
.hamza-link {
    color: var(--hp-primary);
    text-decoration: none;
    font-size: 13px;
}
.hamza-link:hover {
    text-decoration: underline;
}
.hamza-phone-input {
    display: flex;
    gap: 8px;
}
.hamza-phone-prefix {
    max-width: 120px;
    flex-shrink: 0;
}
.hamza-password-strength {
    height: 4px;
    border-radius: 2px;
    margin-top: 6px;
    background: var(--hp-border);
    overflow: hidden;
}
.hamza-password-strength .strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

/* ─────────────────────────────────
 * Buttons
 * ───────────────────────────────── */
.hamza-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    line-height: 1.4;
}
.hamza-btn:active {
    transform: scale(0.98);
}
.hamza-btn-primary {
    background: var(--hp-primary);
    color: var(--hp-white);
}
.hamza-btn-primary:hover {
    background: var(--hp-primary-dark);
    color: var(--hp-white);
}
.hamza-btn-outline {
    background: transparent;
    color: var(--hp-primary);
    border: 2px solid var(--hp-primary);
}
.hamza-btn-outline:hover {
    background: var(--hp-primary);
    color: var(--hp-white);
}
.hamza-btn-full {
    width: 100%;
}
.hamza-btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}
.hamza-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}
.hamza-btn:disabled,
.hamza-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}
.hamza-btn.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: hamza-spin 0.6s linear infinite;
}

@keyframes hamza-spin {
    to { transform: rotate(360deg); }
}

/* ─────────────────────────────────
 * Portal Header
 * ───────────────────────────────── */
.hamza-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}
.hamza-portal-header h2 {
    margin: 0;
    font-size: 26px;
    color: var(--hp-dark);
}
.hamza-portal-subtitle {
    margin: 4px 0 0;
    color: var(--hp-muted);
    font-size: 14px;
}

/* ─────────────────────────────────
 * Stats Row
 * ───────────────────────────────── */
.hamza-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.hamza-stat-box {
    background: var(--hp-white);
    border-radius: var(--hp-radius);
    box-shadow: var(--hp-shadow);
    padding: 20px 24px;
    text-align: center;
}
.hamza-stat-num {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--hp-primary);
}
.hamza-stat-txt {
    display: block;
    font-size: 13px;
    color: var(--hp-muted);
    margin-top: 4px;
}

/* ─────────────────────────────────
 * Actions Row
 * ───────────────────────────────── */
.hamza-actions-row {
    margin-bottom: 28px;
}

/* ─────────────────────────────────
 * Pratica Cards Grid
 * ───────────────────────────────── */
.hamza-pratiche-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}
.hamza-pratica-card {
    background: var(--hp-white);
    border-radius: var(--hp-radius);
    box-shadow: var(--hp-shadow);
    padding: 24px;
    text-decoration: none;
    color: var(--hp-text);
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
    border-left: 4px solid var(--hp-border);
}
.hamza-pratica-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.hamza-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}
.hamza-card-title {
    margin: 0;
    font-size: 16px;
    color: var(--hp-dark);
    line-height: 1.4;
}
.hamza-card-sub {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--hp-muted);
}
.hamza-card-meta {
    font-size: 12px;
    color: var(--hp-muted);
    margin-bottom: 14px;
}

/* ─────────────────────────────────
 * Status Badge
 * ───────────────────────────────── */
.hamza-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hp-white);
    white-space: nowrap;
    line-height: 1.4;
}
.hamza-status-large {
    padding: 8px 20px;
    font-size: 14px;
}

/* ─────────────────────────────────
 * Progress Bar
 * ───────────────────────────────── */
.hamza-progress-bar {
    position: relative;
    padding-top: 10px;
}
.hamza-progress-line {
    position: absolute;
    top: 22px;
    left: 16px;
    right: 16px;
    height: 4px;
    background: var(--hp-border);
    border-radius: 2px;
    z-index: 0;
}
.hamza-progress-fill {
    height: 100%;
    background: var(--hp-status-completata);
    border-radius: 2px;
    transition: width 0.6s ease;
}
.hamza-progress-dots {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}
.hamza-progress-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hp-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: background 0.3s;
}
.hamza-progress-dot.completed {
    background: var(--hp-status-completata);
}
.hamza-progress-dot.current {
    background: var(--hp-primary);
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.2);
}
.hamza-dot-num {
    font-size: 11px;
    font-weight: 700;
    color: var(--hp-white);
    line-height: 1;
}
.hamza-progress-dot:not(.completed):not(.current) .hamza-dot-num {
    color: var(--hp-muted);
}
.hamza-dot-label {
    display: none;
}

/* Detail page progress: show labels */
.hamza-progress-detail .hamza-progress-dots {
    padding-top: 4px;
}
.hamza-progress-detail .hamza-dot-label {
    display: block;
    font-size: 10px;
    color: var(--hp-muted);
    margin-top: 8px;
    white-space: nowrap;
    text-align: center;
}
.hamza-progress-detail .hamza-progress-dot.current .hamza-dot-label,
.hamza-progress-detail .hamza-progress-dot.completed .hamza-dot-label {
    color: var(--hp-dark);
    font-weight: 600;
}
.hamza-progress-detail {
    margin-bottom: 32px;
    padding-bottom: 30px;
}

/* ─────────────────────────────────
 * Detail Page
 * ───────────────────────────────── */
.hamza-back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--hp-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.hamza-back-link:hover {
    text-decoration: underline;
}
.hamza-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.hamza-detail-title {
    margin: 0;
    font-size: 24px;
    color: var(--hp-dark);
}
.hamza-detail-sub {
    margin: 4px 0 0;
    color: var(--hp-muted);
    font-size: 14px;
}
.hamza-detail-info {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding: 16px 20px;
    background: var(--hp-bg);
    border-radius: var(--hp-radius);
}
.hamza-info-item {
    font-size: 14px;
}
.hamza-info-item strong {
    color: var(--hp-dark);
    margin-right: 4px;
}

/* Sections */
.hamza-detail-section {
    margin-bottom: 32px;
}
.hamza-detail-section h3 {
    font-size: 18px;
    color: var(--hp-dark);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--hp-border);
}
.hamza-notes-box {
    background: var(--hp-bg);
    border-radius: var(--hp-radius);
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.7;
}
.hamza-muted {
    color: var(--hp-muted);
    font-size: 13px;
}
.hamza-error {
    color: #E74C3C;
    font-weight: 600;
}

/* ─────────────────────────────────
 * Documents List
 * ───────────────────────────────── */
.hamza-doc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.hamza-doc-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--hp-bg);
    border-radius: 6px;
}
.hamza-doc-icon {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--hp-white);
    flex-shrink: 0;
}
.hamza-doc-type {
    background: #E74C3C;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--hp-white);
}
.hamza-doc-info {
    flex: 1;
    min-width: 0;
}
.hamza-doc-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--hp-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hamza-doc-meta {
    font-size: 12px;
    color: var(--hp-muted);
}

/* ─────────────────────────────────
 * Upload Zone
 * ───────────────────────────────── */
.hamza-upload-zone {
    margin-top: 16px;
}
.hamza-upload-area {
    border: 2px dashed var(--hp-border);
    border-radius: var(--hp-radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}
.hamza-upload-area:hover,
.hamza-upload-area.dragover {
    border-color: var(--hp-primary);
    background: rgba(230, 126, 34, 0.04);
}
.hamza-upload-area p {
    margin: 0 0 4px;
    font-size: 14px;
    color: var(--hp-dark);
}
.hamza-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.hamza-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.hamza-file-preview-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--hp-bg);
    border-radius: 4px;
    font-size: 13px;
}
.hamza-file-remove {
    cursor: pointer;
    color: #E74C3C;
    font-weight: 700;
    border: none;
    background: none;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}
.hamza-upload-btn {
    margin-top: 12px;
}

/* ─────────────────────────────────
 * Messages Thread
 * ───────────────────────────────── */
.hamza-messages-thread {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: var(--hp-bg);
    border-radius: var(--hp-radius);
    margin-bottom: 16px;
}
.hamza-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 14px;
}
.hamza-msg-client {
    background: var(--hp-white);
    border: 1px solid var(--hp-border);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}
.hamza-msg-admin {
    background: var(--hp-primary);
    color: var(--hp-white);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.hamza-msg-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
    font-size: 12px;
}
.hamza-msg-admin .hamza-msg-header {
    color: rgba(255,255,255,0.85);
}
.hamza-msg-time {
    font-weight: 400;
    white-space: nowrap;
}
.hamza-msg-body {
    line-height: 1.5;
}
.hamza-no-messages {
    text-align: center;
    padding: 20px;
}

/* Message form */
.hamza-message-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.hamza-message-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--hp-border);
    border-radius: 6px;
    font-size: 14px;
    resize: vertical;
    min-height: 46px;
}
.hamza-message-form textarea:focus {
    outline: none;
    border-color: var(--hp-primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15);
}

/* ─────────────────────────────────
 * General messages (success / error)
 * ───────────────────────────────── */
.hamza-msg {
    margin-top: 12px;
    font-size: 14px;
}
.hamza-msg.success {
    color: #27AE60;
}
.hamza-msg.error {
    color: #E74C3C;
}

/* ─────────────────────────────────
 * Empty state
 * ───────────────────────────────── */
.hamza-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--hp-white);
    border-radius: var(--hp-radius);
    box-shadow: var(--hp-shadow);
    color: var(--hp-muted);
    font-size: 16px;
}

/* ─────────────────────────────────
 * New Pratica Wrap
 * ───────────────────────────────── */
.hamza-new-pratica-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px;
    background: var(--hp-white);
    border-radius: var(--hp-radius);
    box-shadow: var(--hp-shadow);
}
.hamza-new-pratica-wrap h2 {
    margin: 0 0 6px;
    font-size: 24px;
    color: var(--hp-dark);
}

/* ─────────────────────────────────
 * Responsive
 * ───────────────────────────────── */
@media (max-width: 768px) {
    .hamza-form-row {
        flex-direction: column;
        gap: 0;
    }
    .hamza-pratiche-grid {
        grid-template-columns: 1fr;
    }
    .hamza-detail-header {
        flex-direction: column;
    }
    .hamza-detail-info {
        flex-direction: column;
        gap: 10px;
    }
    .hamza-message {
        max-width: 95%;
    }
    .hamza-message-form {
        flex-direction: column;
    }
    .hamza-message-form .hamza-btn {
        width: 100%;
    }
    .hamza-auth-card {
        padding: 28px 20px;
    }
    .hamza-new-pratica-wrap {
        padding: 20px 16px;
    }
    .hamza-portal-header {
        flex-direction: column;
    }
    .hamza-progress-detail .hamza-dot-label {
        font-size: 8px;
    }
    .hamza-phone-input {
        flex-direction: column;
    }
    .hamza-phone-prefix {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .hamza-stats-row {
        grid-template-columns: 1fr;
    }
    .hamza-stat-num {
        font-size: 26px;
    }
}
