/* ============================================
   HIKLASS TASK MASTER - Styles
   FIVICON Brand Colors:
   - Blue: #0064C8
   - Red: #DC2828
   - White: #FFFFFF
   - Gray: #808080
   ============================================ */

/* CSS Variables */
:root {
    --brand-blue: #0064C8;
    --brand-blue-dark: #003C8C;
    --brand-blue-light: #4A90D9;
    --brand-red: #DC2828;
    --brand-red-dark: #B01E1E;
    --brand-white: #FFFFFF;
    --brand-gray: #808080;
    --brand-light-gray: #E8E8E8;
    
    --primary: var(--brand-blue);
    --primary-dark: var(--brand-blue-dark);
    --accent: var(--brand-red);
    
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-primary: #1A1A2E;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* App Container */
#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-color);
    position: relative;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-blue-dark) 100%);
    color: var(--brand-white);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: var(--brand-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: rgba(255,255,255,0.25);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 8px;
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(255,255,255,0.2);
}

.tab-btn.active {
    background: var(--brand-white);
    color: var(--brand-blue);
}

/* Main Content */
.main-content {
    padding: 16px;
    padding-bottom: 100px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

#taskCount {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.sync-status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sync-status.syncing {
    color: var(--brand-blue);
}

.sync-status.synced {
    color: var(--success);
}

.sync-status.offline {
    color: var(--warning);
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-bar input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--card-bg);
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(0,100,200,0.1);
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Task Card */
.task-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    border-left: 4px solid transparent;
}

.task-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.task-card.priority-low {
    border-left-color: var(--success);
}

.task-card.priority-medium {
    border-left-color: var(--warning);
}

.task-card.priority-high {
    border-left-color: var(--brand-red);
}

.task-card.priority-urgent {
    border-left-color: #9C27B0;
}

.task-card.completed {
    opacity: 0.6;
}

.task-card.completed .task-title {
    text-decoration: line-through;
}

.task-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.task-checkbox:hover {
    border-color: var(--brand-blue);
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: var(--brand-white);
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    word-break: break-word;
}

.task-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.task-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-priority-low {
    background: #D1FAE5;
    color: #065F46;
}

.badge-priority-medium {
    background: #FEF3C7;
    color: #92400E;
}

.badge-priority-high {
    background: #FEE2E2;
    color: var(--brand-red-dark);
}

.badge-priority-urgent {
    background: #F3E8FF;
    color: #6B21A8;
}

.badge-status-pending {
    background: #FEF3C7;
    color: #92400E;
}

.badge-status-in_progress {
    background: #DBEAFE;
    color: var(--brand-blue-dark);
}

.badge-status-completed {
    background: #D1FAE5;
    color: #065F46;
}

.task-deadline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.task-deadline.overdue {
    color: var(--brand-red);
    font-weight: 600;
}

.task-deadline.soon {
    color: var(--warning);
    font-weight: 600;
}

.task-actions {
    display: flex;
    gap: 4px;
}

.task-actions button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.task-actions button:hover {
    background: var(--bg-color);
    color: var(--brand-blue);
}

.task-actions .btn-delete:hover {
    color: var(--brand-red);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    color: var(--brand-light-gray);
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--brand-red);
    color: var(--brand-white);
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
}

.fab:hover {
    background: var(--brand-red-dark);
    transform: scale(1.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-color);
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-color);
}

.modal form {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px rgba(0,100,200,0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--brand-blue);
}

/* Toggle Switch */
.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: var(--brand-white);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
    background: var(--brand-blue);
}

.toggle input:checked + .toggle-slider::after {
    left: 24px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--brand-blue);
    color: var(--brand-white);
}

.btn-primary:hover {
    background: var(--brand-blue-dark);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--brand-red);
    color: var(--brand-white);
}

.btn-danger:hover {
    background: var(--brand-red-dark);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Settings */
.settings-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.settings-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section h3 i {
    color: var(--brand-blue);
}

.settings-section .btn {
    margin-right: 8px;
    margin-bottom: 8px;
}

.link {
    color: var(--brand-blue);
    text-decoration: none;
}

.link:hover {
    text-decoration: underline;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    color: var(--brand-white);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--brand-red);
}

.toast.info {
    background: var(--brand-blue);
}

.toast.warning {
    background: var(--warning);
}

/* Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 150;
}

.install-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.install-content img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
}

.install-content > div {
    flex: 1;
}

.install-content p {
    margin: 0;
}

.install-content p:first-child {
    font-weight: 600;
}

.install-content p:last-child {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (min-width: 768px) {
    #app {
        max-width: 800px;
    }
    
    .modal {
        align-items: center;
    }
    
    .modal-content {
        border-radius: var(--radius-lg);
        max-height: 85vh;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0F172A;
        --card-bg: #1E293B;
        --text-primary: #F1F5F9;
        --text-secondary: #94A3B8;
        --border-color: #334155;
    }
}

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

.task-card {
    animation: fadeIn 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--brand-light-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-gray);
}
