/* MyWebCode - Operator Panel Styles */

.operator-app {
    display: grid;
    grid-template-areas: 
        "header header header"
        "main main aside";
    grid-template-rows: 80px 1fr;
    grid-template-columns: 1fr 1fr 320px;
    height: 100vh;
    background-color: var(--bg-secondary);
    gap: 1rem;
    padding: 0 1rem 1rem;
}

/* Header */
.operator-header {
    grid-area: header;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--text-light);
    padding: 0 2rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow);
    margin: 0 -1rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.app-title {
    font-size: 1.4rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.app-title i {
    margin-right: 0.5rem;
    color: var(--warning-color);
}

.counter-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.counter-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.counter-name {
    font-weight: var(--font-weight-medium);
    font-size: 1.1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.operator-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.operator-name {
    font-weight: var(--font-weight-medium);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.status-icon {
    color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-icon.offline {
    color: var(--danger-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.status-btn.available {
    background-color: var(--success-color);
    color: white;
}

.status-btn.break {
    background-color: var(--warning-color);
    color: white;
}

.status-btn.busy {
    background-color: var(--info-color);
    color: white;
}

.status-btn.offline {
    background-color: var(--text-secondary);
    color: white;
}

.status-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Main Content */
.operator-main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

/* Current Ticket Section */
.current-ticket-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.section-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.section-header h2 i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

.ticket-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    font-weight: var(--font-weight-medium);
    color: var(--primary-color);
}

.current-ticket-card {
    min-height: 200px;
    border: 2px dashed #e9ecef;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.current-ticket-card.has-ticket {
    border: 2px solid var(--secondary-color);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05), rgba(52, 152, 219, 0.1));
}

.no-ticket {
    text-align: center;
    color: var(--text-secondary);
}

.no-ticket i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-ticket h3 {
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-medium);
}

.ticket-display {
    padding: 2rem;
    text-align: center;
    width: 100%;
}

.ticket-number {
    font-size: 4rem;
    font-weight: var(--font-weight-bold);
    color: var(--secondary-color);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.ticket-service {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-medium);
}

.ticket-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.ticket-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.ticket-info-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: var(--font-weight-medium);
}

.ticket-info-value {
    font-size: 1.1rem;
    font-weight: var(--font-weight-medium);
    color: var(--primary-color);
}

.ticket-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

/* Queue Management */
.queue-management {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.queue-overview,
.operator-stats {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

.queue-overview h3,
.operator-stats h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: var(--font-weight-bold);
}

.queue-overview h3 i,
.operator-stats h3 i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

.queues-grid {
    display: grid;
    gap: 1rem;
}

.queue-item {
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    transition: var(--transition);
    cursor: pointer;
}

.queue-item:hover {
    border-color: var(--secondary-color);
    background-color: var(--bg-secondary);
}

.queue-item.selected {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.05), rgba(52, 152, 219, 0.1));
}

/* Stili per servizi fuori orario */
.queue-item.queue-closed {
    opacity: 0.7;
    background-color: #f8f8f8;
    border-left-color: #ccc !important;
    position: relative;
}

.queue-item.queue-closed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.1) 10px,
        rgba(0, 0, 0, 0.05) 10px,
        rgba(0, 0, 0, 0.05) 20px
    );
    pointer-events: none;
}

.queue-item.queue-closed .queue-name {
    color: #888;
}

.queue-time-info {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.queue-time-info i {
    color: #dc3545;
}

.queue-time-info.open i {
    color: #28a745;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.queue-name {
    font-weight: var(--font-weight-medium);
    color: var(--primary-color);
}

.queue-count {
    background: var(--secondary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: var(--font-weight-medium);
}

.queue-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--secondary-color), var(--info-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Recent Activity */
.recent-activity {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

.recent-activity h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: var(--font-weight-bold);
}

.recent-activity h3 i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: var(--info-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 1rem;
    font-size: 0.9rem;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: var(--font-weight-medium);
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Quick Actions Sidebar */
.quick-actions {
    grid-area: aside;
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.quick-actions h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: var(--font-weight-bold);
}

.quick-actions h3 i {
    margin-right: 0.5rem;
    color: var(--warning-color);
}

.action-group {
    margin-bottom: 2rem;
}

.action-group h4 {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    font-weight: var(--font-weight-medium);
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.status-options {
    display: grid;
    gap: 0.5rem;
}

.status-option {
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: var(--font-weight-medium);
}

.status-option:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.status-option.active {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
}

.status-option.available {
    color: var(--success-color);
}

.status-option.break {
    color: var(--warning-color);
}

.status-option.busy {
    color: var(--info-color);
}

.status-option.offline {
    color: var(--text-secondary);
}

.action-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: var(--font-weight-medium);
}

.action-btn:hover {
    border-color: var(--secondary-color);
    background: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
}

.status-badge.available {
    background-color: var(--success-color);
    color: white;
}

.status-badge.break {
    background-color: var(--warning-color);
    color: white;
}

.status-badge.busy {
    background-color: var(--info-color);
    color: white;
}

.status-badge.offline {
    background-color: var(--text-secondary);
    color: white;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2980b9;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #219a52;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #d68910;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c0392b;
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background-color: var(--bg-secondary);
    color: var(--danger-color);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: var(--font-weight-medium);
    color: var(--primary-color);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Notifications */
.notification-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 2500;
    max-width: 400px;
}

.notification {
    background: var(--bg-primary);
    border-left: 4px solid;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideInRight 0.3s ease-out;
}

.notification.success {
    border-left-color: var(--success-color);
}

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

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification.info {
    border-left-color: var(--info-color);
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: var(--primary-color);
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

/* Animations */
@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .operator-app {
        grid-template-areas: 
            "header header"
            "main aside";
        grid-template-columns: 1fr 300px;
    }
    
    .queue-management {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 968px) {
    .operator-app {
        grid-template-areas: 
            "header"
            "main";
        grid-template-columns: 1fr;
        padding: 0;
    }
    
    .operator-header {
        margin: 0;
        border-radius: 0;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .header-left,
    .header-right {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .quick-actions {
        position: fixed;
        top: 100px;
        right: -320px;
        height: calc(100vh - 100px);
        width: 300px;
        z-index: 1500;
        transition: right 0.3s ease;
    }
    
    .quick-actions.mobile-open {
        right: 0;
    }
    
    .operator-main {
        padding: 1rem;
    }
    
    .ticket-actions {
        grid-template-columns: 1fr 1fr;
    }
    
    .queue-management {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .ticket-actions {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .ticket-info {
        flex-direction: column;
        gap: 1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}
