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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Footer */
.footer {
    background: #f8f9fa;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #dee2e6;
    margin-top: auto;
}

.footer-left {
    display: flex;
    align-items: center;
}

.footer-right {
    display: flex;
    align-items: center;
}

.github-link {
    display: inline-block;
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.github-link:hover {
    color: #495057;
}

.copyright {
    font-size: 0.9rem;
    color: #6c757d;
}

.purpleship-link {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s ease;
}

.purpleship-link:hover {
    color: #495057;
}

/* Home Screen */
.home-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    padding: 20px;
}

.home-container {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.logo {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -2px;
}

.logo-q {
    color: #212529;
}

.logo-note {
    color: #6c757d;
}

.tagline {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 3rem;
    font-weight: 300;
    letter-spacing: 1px;
}

/* Room Input */
.room-input-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.pin-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 2rem;
}

.pin-input {
    width: 50px;
    height: 60px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    background: white;
    transition: all 0.2s ease;
    color: #212529;
}

.pin-input::placeholder {
    color: #e9ecef;
    font-weight: 300;
    opacity: 0.7;
}

.pin-input:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 3px rgba(73, 80, 87, 0.1);
    background: #fff;
}

.pin-input.filled {
    background: #f8f9fa;
    color: #495057;
}

.room-number-label {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 400;
    margin: 1.5rem 0 1rem 0;
}

.random-room {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.random-btn {
    background: none;
    border: 2px solid #6c757d;
    color: #6c757d;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.random-btn:hover {
    background: #6c757d;
    color: white;
}

/* Note Screen */
#noteScreen .container {
    justify-content: flex-start;
    padding-top: 40px;
}

.pin-display {
    display: flex;
    gap: 8px;
    margin: 20px 0;
}

.pin-digit {
    width: 40px;
    height: 50px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    background: white;
    color: #212529;
}

.note-container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.note-header {
    background: white !important;
    padding: 1rem 2rem !important;
    border-bottom: 1px solid #dee2e6 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: auto !important;
}

.room-info {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #495057 !important;
    font-weight: 500 !important;
    flex-shrink: 0 !important;
}

.share-btn {
    background: none !important;
    border: none !important;
    color: #6c757d !important;
    cursor: pointer !important;
    padding: 8px !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.share-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.room-info h1 {
    font-size: 1.5rem;
    color: #495057;
    margin: 0;
}

.room-number {
    color: #212529;
    font-weight: 700;
}

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

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-primary {
    background: #495057;
    color: white;
}

.btn-primary:hover {
    background: #343a40;
}

.btn-primary:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

.note-editor {
    border: none;
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    font-family: inherit;
    background: white;
    color: #212529;
    min-height: 300px;
    width: 100%;
    overflow: hidden;
}

.note-footer {
    margin-top: 1rem;
    padding: 1rem 2rem;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #6c757d;
    font-size: 0.9rem;
    min-height: 60px;
}

.save-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-status.saved {
    color: #495057;
}

.save-status .save-icon {
    width: 16px;
    height: 16px;
}

.save-status.saved .save-icon {
    stroke: #495057;
}

.action-buttons {
    padding: 1rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-message {
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    opacity: 0.9;
}

/* Toast Message */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 300px;
    text-align: center;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.toast.success {
    background: rgba(73, 80, 87, 0.9);
}

.toast.error {
    background: rgba(220, 53, 69, 0.9);
}

.toast.warning {
    background: rgba(255, 193, 7, 0.9);
    color: #212529;
}



/* Responsive */
@media (max-width: 768px) {
    .home-container {
        padding: 1rem;
    }
    
    .logo {
        font-size: 3rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .pin-inputs {
        gap: 8px;
    }
    
    .pin-input {
        width: 40px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .note-content {
        padding: 1rem;
    }
    
    .note-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .modal {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

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