/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logos-container {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.logo-link {
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo-deversus {
    height: 45px;
}

.logo-bni {
    height: 55px;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Layout principale */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
}

/* Sidebar qualità */
.quality-sidebar {
    position: sticky;
    top: 20px;
}

.quality-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.quality-card h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #2d3748;
}

.quality-score {
    text-align: center;
    margin-bottom: 25px;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(#f6d55c 0deg 0deg, #e2e8f0 0deg 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    position: relative;
    transition: all 0.5s ease;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
}

#quality-percentage {
    position: relative;
    z-index: 1;
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
}

.score-label {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 500;
}

/* Checklist qualità */
.quality-checklist {
    margin-bottom: 20px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.check-icon {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.check-item.completed .check-icon {
    color: #48bb78;
}

.check-item.warning .check-icon {
    color: #ed8936;
}

.check-item.pending .check-icon {
    color: #a0aec0;
}

/* Suggerimenti */
.quality-suggestions h4 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #2d3748;
}

#suggestions-list {
    list-style: none;
}

#suggestions-list li {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 5px;
    padding-left: 15px;
    position: relative;
}

#suggestions-list li::before {
    content: '💡';
    position: absolute;
    left: 0;
}

/* Area principale */
.main-area {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

/* Step cards */
.step-card {
    padding: 30px;
    display: none;
    animation: slideIn 0.5s ease-out;
}

.step-card.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f7fafc;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6d55c 0%, #fd9d47 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.step-header h2 {
    font-size: 1.8rem;
    color: #2d3748;
    font-weight: 600;
}

/* Form elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.form-control:focus {
    outline: none;
    border-color: #f6d55c;
    box-shadow: 0 0 0 3px rgba(246, 213, 92, 0.1);
    background: white;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #718096;
}

/* Textarea specifica */
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Select styling */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Profile preview */
.profile-preview {
    background: linear-gradient(135deg, #f6d55c 0%, #fd9d47 100%);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.profile-preview h4 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.profile-info p {
    color: white;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.profile-info strong {
    font-weight: 600;
}

/* Settings grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.btn-ai {
    background: linear-gradient(135deg, #f6d55c 0%, #fd9d47 100%);
    color: #2d3748;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.btn-ai:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(246, 213, 92, 0.4);
}

.btn-generate {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 18px 36px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(72, 187, 120, 0.4);
}

/* Step navigation */
.step-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f7fafc;
}

/* Loading states */
.loading {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #f6d55c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* AI Analysis Result */
.ai-result {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #f6d55c;
}

.ai-result h4 {
    color: #2d3748;
    margin-bottom: 15px;
}

.analysis-score {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    font-weight: 600;
}

.score-value {
    background: linear-gradient(135deg, #f6d55c 0%, #fd9d47 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Speech Results */
.speeches-container {
    margin-top: 30px;
}

.speech-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.speech-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.speech-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.speech-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.speech-meta {
    font-size: 0.85rem;
    color: #718096;
}

.speech-content {
    font-size: 1rem;
    line-height: 1.7;
    color: #2d3748;
    margin-bottom: 15px;
}

.speech-actions {
    display: flex;
    gap: 10px;
}

.btn-copy {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: #cbd5e0;
}

.btn-copy.copied {
    background: #48bb78;
    color: white;
}

.btn-edit {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* NUOVO: Practice Timer */
.practice-timer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e2e8f0;
}

.timer-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    color: white;
    text-align: center;
}

.timer-card h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.timer-description {
    opacity: 0.9;
    margin-bottom: 25px;
    font-size: 1rem;
}

.timer-display-container {
    margin: 30px 0;
}

.timer-display {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.timer-display.warning {
    color: #fed7d7;
    animation: pulse 1s infinite;
}

.timer-display.danger {
    color: #fc8181;
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-progress {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
    max-width: 300px;
}

.timer-progress-bar {
    height: 100%;
    background: white;
    border-radius: 4px;
    transition: width 1s linear;
    width: 100%;
}

.timer-controls {
    margin: 25px 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.timer-btn {
    background: white;
    color: #667eea;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.timer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.timer-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.timer-btn-secondary:hover {
    background: white;
    color: #667eea;
}

.timer-settings {
    margin: 20px 0;
}

.audio-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.audio-toggle:hover {
    opacity: 1;
}

.audio-toggle input[type="checkbox"] {
    margin: 0;
}

.timer-tips {
    margin-top: 25px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.tip {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    border-left: 3px solid white;
}

/* NUOVO: Speech Editor Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.speech-editor {
    padding: 0;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f7fafc;
    background: linear-gradient(135deg, #f6d55c 0%, #fd9d47 100%);
    border-radius: 20px 20px 0 0;
}

.editor-header h3 {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.editor-stats {
    display: flex;
    gap: 25px;
    padding: 20px 30px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.95rem;
}

.stat-label {
    color: #718096;
    font-weight: 500;
}

.stat-value {
    color: #2d3748;
    font-weight: 700;
}

.stat-target {
    color: #718096;
    font-size: 0.9rem;
}

.stat-status {
    padding: 2px 8px;
    border-radius: 12px;
    background: #e6fffa;
    color: #234e52;
    font-size: 0.85rem;
    font-weight: 600;
}

.stat-status.over-limit {
    background: #fed7d7;
    color: #742a2a;
}

.stat-status.under-limit {
    background: #fef5e7;
    color: #744210;
}

.editor-content {
    padding: 30px;
}

.speech-textarea {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: all 0.3s ease;
}

.speech-textarea:focus {
    outline: none;
    border-color: #f6d55c;
    box-shadow: 0 0 0 3px rgba(246, 213, 92, 0.1);
}

.editor-actions {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    border-top: 2px solid #f7fafc;
    justify-content: flex-end;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .quality-sidebar {
        position: static;
        order: 2;
    }
    
    .main-area {
        order: 1;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .logos-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .step-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .timer-display {
        font-size: 3rem;
    }
    
    .timer-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .timer-btn {
        width: 100%;
        max-width: 250px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .editor-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .editor-actions {
        flex-direction: column;
    }
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}