/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    color: #e0e0e0;
    min-height: 100vh;
    direction: rtl;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

/* Attendance Card */
.attendance-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    padding: 50px 30px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.attendance-card h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #64b5f6, #42a5f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Username Section */
.username-section {
    margin-bottom: 30px;
    text-align: center;
}

.username-section label {
    display: block;
    font-size: 1.1rem;
    color: #e0e0e0;
    margin-bottom: 10px;
    font-weight: 500;
}

.username-section input {
    width: 100%;
    max-width: 300px;
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.username-section input:focus {
    outline: none;
    border-color: #64b5f6;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(100, 181, 246, 0.3);
}

.username-section input::placeholder {
    color: rgba(224, 224, 224, 0.6);
}

.username-section input:disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #81c784;
    cursor: not-allowed;
}

.username-section input.username-saved {
    border-color: #81c784;
    background: rgba(129, 199, 132, 0.1);
}

.save-username-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    background: linear-gradient(45deg, #64b5f6, #42a5f5);
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.3);
}

.save-username-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 181, 246, 0.4);
}

.save-username-btn:active {
    transform: translateY(0);
}



.current-time {
    font-size: 1.3rem;
    color: #81c784;
    font-weight: 500;
    margin-bottom: 40px;
}

/* Attendance Buttons Container */
.attendance-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

/* Attendance Button */
.attendance-btn {
    width: 100%;
    max-width: 300px;
    padding: 20px 30px;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: white;
}

/* Check-in Button */
.checkin-btn {
    background: linear-gradient(45deg, #4caf50, #66bb6a);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

/* Check-out Button */
.checkout-btn {
    background: linear-gradient(45deg, #f44336, #ef5350);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
    margin-top: 20px;
}

.checkin-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.checkout-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(244, 67, 54, 0.4);
}

.attendance-btn:active {
    transform: translateY(-1px);
}

.attendance-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.icon {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Status Message */
.status-message {
    margin-top: 30px;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-message.show {
    opacity: 1;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.status-message.error {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ef5350;
}

.status-message.loading {
    background: rgba(100, 181, 246, 0.2);
    border: 1px solid rgba(100, 181, 246, 0.3);
    color: #64b5f6;
}

.status-message.info {
    background: rgba(156, 39, 176, 0.2);
    border: 1px solid rgba(156, 39, 176, 0.3);
    color: #ba68c8;
}

.status-message.warning {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Install Button */
.install-btn {
    background: linear-gradient(45deg, #9c27b0, #ba68c8);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
}

/* PWA Install Section */
.pwa-install-section {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.install-info {
    margin-top: 10px;
    color: #b0b0b0;
    font-size: 0.9rem;
}

.install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

.install-btn:active {
    transform: translateY(0);
}

/* PWA Standalone Mode */
.pwa-standalone .attendance-card {
    border-radius: 0;
    min-height: 100vh;
}

.pwa-standalone .container {
    padding: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .attendance-card {
        padding: 40px 20px;
    }
    
    .attendance-card h1 {
        font-size: 2rem;
    }
    
    .attendance-buttons {
        gap: 12px;
    }
    
    .attendance-btn {
        padding: 18px 25px;
        font-size: 1.1rem;
    }
}

/* Leave Button */
.leave-btn {
    background: linear-gradient(45deg, #ff9800, #ffb74d);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3);
}

.leave-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
}

/* My Leaves Button */
.my-leaves-btn {
    background: linear-gradient(45deg, #9c27b0, #ba68c8);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);
}

/* Location Section */
.location-section {
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.location-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.location-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.location-info span:last-child {
    font-size: 1.1rem;
    color: #e0e0e0;
    font-weight: 500;
}

.location-coordinates {
    font-size: 0.9rem;
    color: #b0b0b0;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    display: inline-block;
}

.location-error {
    color: #ef5350;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.2);
}

.location-success {
    color: #81c784;
    background: rgba(129, 199, 132, 0.1);
    border: 1px solid rgba(129, 199, 132, 0.2);
}

.my-leaves-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.4);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(45deg, #ff9800, #ffb74d);
    color: white;
    padding: 20px 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
}

.close:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

/* Leave Form */
.leave-form {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 500;
    font-size: 1rem;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff9800;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
}

.form-group select option {
    background: #2d2d44;
    color: #e0e0e0;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group textarea::placeholder {
    color: rgba(224, 224, 224, 0.6);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-submit {
    background: linear-gradient(45deg, #ff9800, #ffb74d);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .leave-form {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-submit {
        width: 100%;
    }
}

/* My Leaves Modal Specific Styles */
.my-leaves-modal {
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
}

.leaves-container {
    padding: 25px;
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Custom Scrollbar for leaves container */
.leaves-container::-webkit-scrollbar {
    width: 8px;
}

.leaves-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.leaves-container::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #ff9800, #ffb74d);
    border-radius: 10px;
}

.leaves-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #f57c00, #ff9800);
}

.loading-leaves {
    text-align: center;
    padding: 40px 20px;
    color: #e0e0e0;
}

.loading-leaves p {
    margin-top: 20px;
    font-size: 1.1rem;
}

.leaves-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.leave-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.leave-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.leave-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leave-type {
    background: linear-gradient(45deg, #ff9800, #ffb74d);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.leave-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

.leave-status.pending {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.leave-status.approved {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.leave-status.rejected {
    background: rgba(244, 67, 54, 0.2);
    color: #ef5350;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.leave-dates {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.date-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-label {
    font-size: 0.9rem;
    color: #b0b0b0;
    font-weight: 500;
}

.date-value {
    font-size: 1rem;
    color: #e0e0e0;
    font-weight: 600;
}

.leave-reason {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.reason-label {
    font-size: 0.9rem;
    color: #b0b0b0;
    margin-bottom: 8px;
    font-weight: 500;
}

.reason-text {
    color: #e0e0e0;
    line-height: 1.5;
}

.leave-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #b0b0b0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
}

.leave-id {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: monospace;
}

.no-leaves {
    text-align: center;
    padding: 60px 20px;
    color: #b0b0b0;
}

.no-leaves p {
    font-size: 1.2rem;
    margin: 0;
}

/* Responsive for My Leaves Modal */
@media (max-width: 768px) {
    .my-leaves-modal {
        margin: 5% auto;
        width: 95%;
    }
    
    .leaves-container {
        padding: 20px;
    }
    
    .leave-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .leave-dates {
        flex-direction: column;
        gap: 10px;
    }
    
    .leave-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .location-section {
        padding: 15px;
        margin: 15px 0;
    }
    
    .location-info {
        flex-direction: column;
        gap: 8px;
    }
}

/* SweetAlert2 Custom Styles */
.swal2-popup {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    direction: rtl !important;
    text-align: right !important;
}

.swal2-title {
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: #2d2d44 !important;
}

.swal2-content {
    font-size: 1rem !important;
    color: #666 !important;
}

.swal2-confirm {
    font-weight: 600 !important;
    border-radius: 10px !important;
    padding: 12px 25px !important;
    font-size: 1rem !important;
}

.swal2-cancel {
    font-weight: 600 !important;
    border-radius: 10px !important;
    padding: 12px 25px !important;
    font-size: 1rem !important;
}

.swal2-icon {
    border-width: 3px !important;
}

.swal2-icon.swal2-success {
    border-color: #4caf50 !important;
}

.swal2-icon.swal2-error {
    border-color: #f44336 !important;
}

.swal2-icon.swal2-warning {
    border-color: #ff9800 !important;
}

.swal2-icon.swal2-question {
    border-color: #2196f3 !important;
}
