* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* IMPORTANTE: Solo una schermata visibile alla volta */
.screen {
    display: none !important;
    position: absolute;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: block !important;
    position: relative;
}

/* Login */
#loginScreen {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#loginScreen.active {
    display: flex !important;
    justify-content: center;
    align-items: center;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #667eea;
}

.login-box input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.login-box button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.error {
    color: #e74c3c;
    text-align: center;
    margin-top: 10px;
}

/* Header */
header {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 24px;
    color: #667eea;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn:hover {
    background: #5568d3;
}

.btn-logout {
    padding: 10px 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

/* Editor Container */
#editorContainer {
    max-width: 900px;
    margin: 30px auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.editor-header input[type="date"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.editor-header h2 {
    color: #667eea;
    flex-grow: 1;
    text-align: center;
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.btn-nav {
    padding: 8px 15px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-nav:hover {
    background: #e0e0e0;
}

.title-input {
    width: 100%;
    padding: 15px;
    border: none;
    border-bottom: 2px solid #ddd;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.title-input:focus {
    outline: none;
    border-bottom-color: #667eea;
}

.meta-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.meta-bar label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #667eea;
    font-size: 14px;
}

.meta-bar select,
.meta-bar input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

#editor {
    min-height: 300px;
    margin-bottom: 20px;
}

.photo-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.photo-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #667eea;
}

.photo-section input[type="file"] {
    padding: 10px;
    border: 2px dashed #667eea;
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
}

#photoPreview {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.photo-item {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-save {
    width: 100%;
    padding: 15px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
}

.btn-save:hover {
    background: #229954;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #667eea;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.date-picker-content {
    text-align: center;
}

.date-picker-content input {
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
}

.entry-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.entry-item:hover {
    background: #f9f9f9;
}

.entry-date {
    color: #667eea;
    font-weight: bold;
    margin-bottom: 5px;
}

.entry-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.entry-preview {
    color: #666;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-buttons {
        width: 100%;
    }
    
    .btn-nav {
        flex: 1;
    }
}
