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

body {
    font-family: 'Vazirmatn', 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.tab {
    flex: 1;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: #f8f9fa;
    border: none;
    font-size: 18px;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: white;
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.tab i {
    margin-left: 10px;
    font-size: 20px;
}

.content {
    display: none;
    padding: 30px;
}

.content.active {
    display: block;
}

/* Timer Styles */
.timer-display {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    margin-bottom: 30px;
}

.timer-display h1 {
    font-size: 72px;
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: 5px;
}

.timer-status {
    font-size: 18px;
    opacity: 0.9;
}

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

.recent-parts {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
}

.recent-parts h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

#recentPartsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-part-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-right: 5px solid #667eea;
}

.recent-part-info {
    display: flex;
    flex-direction: column;
}

.recent-part-info span {
    font-size: 14px;
    color: #6c757d;
}

.recent-part-info strong {
    font-size: 16px;
    color: #2c3e50;
    margin-bottom: 5px;
}

.recent-part-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.status-indicator.synced {
    background-color: #2ecc71;
    color: white;
}

.status-indicator.unsynced {
    background-color: #f39c12;
    color: white;
}

.save-btn {
    padding: 8px 15px;
    font-size: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.save-btn:hover {
    background-color: #2980b9;
}


.btn {
    padding: 15px 40px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Vazirmatn', 'Vazir', sans-serif;
}

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

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

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.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;
    padding: 15px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
}

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

.modal-header h2 {
    color: #2c3e50;
    font-size: 20px;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: #6c757d;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: #f8f9fa;
    color: #e74c3c;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Vazirmatn', 'Vazir', sans-serif;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.btn-option {
    padding: 12px 8px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-family: 'Vazirmatn', 'Vazir', sans-serif;
    text-align: center;
}

.btn-option:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.btn-option.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Calendar Styles */
.calendar-container {
    max-width: 100%;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    gap: 15px;
}

.calendar-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    min-width: 45px;
}

.calendar-header button:hover {
    background: rgba(255,255,255,0.3);
}

.calendar-header h2 {
    font-size: 20px;
    flex: 1;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day-header {
    text-align: center;
    padding: 12px 5px;
    font-weight: 600;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.calendar-day:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.2);
}

.calendar-day.has-data {
    background: transparent;
    border-color: #e9ecef;
}

.calendar-day.today {
    background: #f39c12 !important;
    color: white !important;
}

.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day-number {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.calendar-day-indicator {
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
    position: absolute;
    bottom: 6px;
}

.drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.3);
    transform: translateY(100%);
    transition: transform 0.4s;
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
}

.drawer.active {
    transform: translateY(0);
}

.drawer-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.drawer-header h3 {
    font-size: 18px;
}

.drawer-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}

.drawer-content {
    padding: 20px;
}

.part-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-right: 5px solid #667eea;
    position: relative;
}

.part-card h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 16px;
}

.part-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    color: #6c757d;
    flex-wrap: wrap;
    gap: 10px;
}

.part-info span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.part-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e9ecef;
}

.part-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.part-details-btn,
.part-edit-btn,
.part-delete-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Vazirmatn', 'Vazir', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.part-details-btn {
    background: #667eea;
    color: white;
}

.part-edit-btn {
    background: #f39c12;
    color: white;
}

.part-delete-btn {
    background: #e74c3c;
    color: white;
}

.part-details-btn:hover {
    background: #5568d3;
}

.part-edit-btn:hover {
    background: #e67e22;
}

.part-delete-btn:hover {
    background: #c0392b;
}

.detail-row {
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

/* Statistics Styles */
.stats-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stats-controls button {
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    font-family: 'Vazirmatn', 'Vazir', sans-serif;
}

.stats-controls button:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.stats-controls button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(102,126,234,0.3);
}

.stat-card i {
    font-size: 28px;
    margin-bottom: 12px;
    opacity: 0.8;
}

.stat-card h3 {
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 8px;
    opacity: 0.9;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.chart-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.chart-card h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 16px;
}

.chart-wrapper {
    position: relative;
    height: 280px;
}

.confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.confirm-modal.active {
    display: flex;
}

.confirm-content {
    background: white;
    padding: 25px;
    border-radius: 15px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.confirm-content h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.confirm-content p {
    margin-bottom: 25px;
    color: #6c757d;
    font-size: 15px;
}

.confirm-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.confirm-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* Notes Styles */
.notes-container {
    display: flex;
    flex-direction: column;
    height: 600px;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.notes-header button {
    background: #667eea;
    border: none;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
}

.notes-header h2 {
    font-size: 18px;
}

.notebook {
    flex-grow: 1;
    background-color: #ffffe0;
    border: 1px solid #ccc;
    border-radius: 15px;
    padding: 10px 20px;
    font-family: 'Vazirmatn', 'Vazir', sans-serif;
    font-size: 16px;
    line-height: 32px;
    background-image: linear-gradient(to bottom, #ddd 1px, transparent 1px);
    background-size: 100% 32px;
    background-repeat: repeat-y;
    background-attachment: local;
    background-position-y: 10px;
    resize: none;
}

.notebook:focus {
    outline: none;
}

/* Backup Styles */
.backup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.backup-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 500px;
}

.backup-controls .btn {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    font-size: 16px;
}

.backup-info-below {
    margin-top: 10px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 10px;
    width: 100%;
    max-width: 300px;
    text-align: center;
    font-size: 14px;
    color: #495057;
}

.upload-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.backup-info {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border-right: 5px solid #667eea;
    max-width: 600px;
    text-align: right;
    margin-top: 20px;
}

.backup-info p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: #495057;
    font-size: 16px;
}

.note-status {
    font-size: 12px;
    color: #6c757d;
    margin: 0 10px;
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        border-radius: 15px;
    }

    .content {
        padding: 15px;
    }

    .tab {
        font-size: 14px;
        padding: 15px 8px;
    }

    .tab span {
        display: none;
    }

    .tab i {
        margin-left: 0;
        font-size: 22px;
    }

    .timer-display {
        padding: 40px 15px;
    }

    .timer-display h1 {
        font-size: 48px;
        letter-spacing: 3px;
    }

    .timer-status {
        font-size: 16px;
    }

    .timer-controls {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        padding: 12px 30px;
        font-size: 15px;
    }

    .modal-content {
        padding: 20px;
        max-height: 85vh;
    }

    .modal-header h2 {
        font-size: 18px;
    }

    .btn-group {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 8px;
    }

    .btn-option {
        padding: 10px 6px;
        font-size: 13px;
    }

    .calendar-header {
        padding: 15px;
    }

    .calendar-header h2 {
        font-size: 16px;
    }

    .calendar-header button {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 40px;
    }

    .calendar-grid {
        gap: 5px;
    }

    .calendar-day {
        padding: 5px;
    }

    .calendar-day-number {
        font-size: 13px;
    }

    .calendar-day-indicator {
        width: 5px;
        height: 5px;
        bottom: 4px;
    }

    .calendar-day-header {
        padding: 8px 3px;
        font-size: 12px;
    }

    .drawer {
        max-height: 85vh;
    }

    .drawer-header {
        padding: 15px;
    }

    .drawer-header h3 {
        font-size: 16px;
    }

    .drawer-content {
        padding: 15px;
    }

    .part-card {
        padding: 12px;
    }

    .part-card h4 {
        font-size: 15px;
    }

    .part-info {
        font-size: 12px;
    }

    .part-actions {
        flex-direction: column;
    }

    .part-details-btn,
    .part-delete-btn {
        width: 100%;
        min-width: 100%;
    }

    .stats-controls {
        gap: 6px;
    }

    .stats-controls button {
        padding: 8px 12px;
        font-size: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card i {
        font-size: 24px;
    }

    .stat-card h3 {
        font-size: 12px;
    }

    .stat-card .value {
        font-size: 26px;
    }

    .charts-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .chart-card {
        padding: 15px;
    }

    .chart-card h3 {
        font-size: 15px;
        margin-bottom: 12px;
    }

    .chart-wrapper {
        height: 220px;
    }

    .confirm-content {
        padding: 20px;
    }

    .confirm-content h3 {
        font-size: 16px;
    }

    .confirm-content p {
        font-size: 14px;
    }

    .confirm-buttons {
        flex-direction: column;
    }

    .confirm-buttons .btn {
        width: 100%;
    }
    
    .backup-controls {
        gap: 15px;
    }
    
    .backup-info {
        padding: 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .timer-display h1 {
        font-size: 40px;
    }

    .calendar-day-number {
        font-size: 12px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .chart-wrapper {
        height: 200px;
    }
}

@media (min-width: 1200px) {
    .calendar-container {
        width: 35%;
        margin: 0 auto;
    }
}

/* Smooth scrolling */
.modal-content::-webkit-scrollbar,
.drawer::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track,
.drawer::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-content::-webkit-scrollbar-thumb,
.drawer::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover,
.drawer::-webkit-scrollbar-thumb:hover {
    background: #555;
}