/**
 * Noon Presenze - Frontend Styles
 */

/* Variables */
:root {
    --noon-primary: #0078d4;
    --noon-primary-dark: #005a9e;
    --noon-secondary: #f4a100;
    --noon-success: #28a745;
    --noon-warning: #ffc107;
    --noon-danger: #dc3545;
    --noon-light: #f8f9fa;
    --noon-dark: #343a40;
    --noon-border: #dee2e6;
    --noon-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --noon-radius: 8px;
}

/* Form Wrapper */
.noon-presenze-form-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: var(--noon-radius);
    box-shadow: var(--noon-shadow);
}

/* Header */
.noon-presenze-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--noon-primary);
}

.noon-presenze-logo img {
    max-height: 50px;
    width: auto;
}

.noon-presenze-title h2 {
    margin: 0;
    color: var(--noon-primary);
    font-size: 1.5rem;
}

.noon-presenze-date {
    margin: 5px 0 0;
    color: #666;
    font-size: 0.9rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-open {
    background: #d4edda;
    color: #155724;
}

.status-closed {
    background: #f8d7da;
    color: #721c24;
}

.status-submitted {
    background: #d1ecf1;
    color: #0c5460;
}

.status-expired {
    background: #fff3cd;
    color: #856404;
}

.status-draft {
    background: #e2e3e5;
    color: #383d41;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

/* Notices */
.noon-presenze-notice {
    padding: 12px 16px;
    border-radius: var(--noon-radius);
    margin-bottom: 20px;
}

.noon-presenze-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.noon-presenze-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.noon-presenze-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.noon-presenze-modified {
    background: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--noon-radius);
}

.noon-presenze-modified strong {
    color: #d63638;
}

/* User Info */
.noon-presenze-user-info {
    background: var(--noon-light);
    padding: 12px 16px;
    border-radius: var(--noon-radius);
    margin-bottom: 20px;
}

.noon-presenze-user-info .user-name {
    font-size: 1rem;
}

/* Meta Fields */
.noon-presenze-meta-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--noon-light);
    border-radius: var(--noon-radius);
}

/* Fields Grid */
.noon-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

/* Field Groups */
.noon-field-group {
    margin-bottom: 0;
}

.noon-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--noon-dark);
}

.noon-field-group label .required {
    color: var(--noon-danger);
}

.noon-field-group input,
.noon-field-group select,
.noon-field-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--noon-border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.noon-field-group input:focus,
.noon-field-group select:focus,
.noon-field-group textarea:focus {
    outline: none;
    border-color: var(--noon-primary);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
}

.noon-field-group input[readonly],
.noon-field-group select[disabled],
.noon-field-group textarea[readonly] {
    background: #e9ecef;
    cursor: not-allowed;
}

/* Field Types */
.field-type-time input {
    text-align: center;
}

.field-type-number input {
    text-align: center;
}

.field-type-textarea {
    grid-column: 1 / -1;
}

/* Signature */
.noon-presenze-signature {
    margin-top: 20px;
    padding: 15px;
    background: var(--noon-light);
    border-radius: var(--noon-radius);
}

.noon-presenze-signature label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--noon-dark);
}

.signature-pad-container {
    border: 2px dashed var(--noon-border);
    border-radius: 4px;
    background: #fff;
    margin-bottom: 10px;
}

.signature-pad {
    width: 100%;
    height: 150px;
    cursor: crosshair;
}

.btn-clear-signature {
    padding: 8px 16px;
    background: var(--noon-light);
    border: 1px solid var(--noon-border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-clear-signature:hover {
    background: #e9ecef;
}

/* Actions */
.noon-presenze-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--noon-border);
}

.noon-presenze-actions button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: var(--noon-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-save-draft {
    background: var(--noon-light);
    border: 2px solid var(--noon-border) !important;
    color: var(--noon-dark);
}

.btn-save-draft:hover {
    background: #e9ecef;
}

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

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

.btn-icon {
    font-size: 1.1em;
}

/* Feedback */
.noon-presenze-feedback {
    margin-top: 15px;
    text-align: center;
}

.noon-presenze-feedback.success {
    color: var(--noon-success);
}

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

/* Footer */
.noon-presenze-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--noon-border);
    text-align: right;
    color: #666;
}

/* Dashboard */
.noon-presenze-dashboard {
    max-width: 800px;
    margin: 0 auto;
}

.noon-presenze-dashboard h2 {
    color: var(--noon-primary);
    margin-bottom: 20px;
}

.noon-dashboard-card {
    background: #fff;
    border-radius: var(--noon-radius);
    box-shadow: var(--noon-shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.noon-dashboard-card h3 {
    margin: 0 0 5px;
    color: var(--noon-dark);
}

.noon-dashboard-date {
    color: #666;
    margin: 0 0 15px;
}

.noon-dashboard-status {
    margin-bottom: 15px;
}

.noon-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

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

.noon-btn-primary:hover {
    background: var(--noon-primary-dark);
    color: #fff;
}

.noon-dashboard-history {
    margin-top: 30px;
}

.noon-dashboard-history h3 {
    color: var(--noon-dark);
    margin-bottom: 15px;
}

.noon-history-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--noon-radius);
    overflow: hidden;
    box-shadow: var(--noon-shadow);
}

.noon-history-table th,
.noon-history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--noon-border);
}

.noon-history-table th {
    background: var(--noon-light);
    font-weight: 600;
    color: var(--noon-dark);
}

.noon-history-table tbody tr:last-child td {
    border-bottom: none;
}

.noon-history-table tbody tr:hover {
    background: #f8f9fa;
}

/* Responsive */
@media (max-width: 768px) {
    .noon-presenze-header {
        flex-direction: column;
        text-align: center;
    }
    
    .noon-fields-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .noon-presenze-actions {
        flex-direction: column;
    }
    
    .noon-presenze-meta-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .noon-fields-grid {
        grid-template-columns: 1fr;
    }
    
    .noon-presenze-form-wrapper {
        padding: 15px;
    }
}
