@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --color-primary: #5a78ff;
    --color-secondary: #0957ff;
}

body {
    position: relative;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.author-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

.container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 1000px;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.3);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 15px;
}

.container header {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    margin-bottom: 25px;
    text-align: center;
    padding: 20px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
    padding: 5px 0;
}

/* Enhanced input section styling */
.input-section {
    width: 100%;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.input-section .add-task-button {
    display: flex;
    justify-content: center;
    align-items: center;
}

.input-section > * {
    min-width: 0; /* Prevent flex items from overflowing */
}

.input-section input,
.input-section select {
    transition: all 0.3s ease;
}

.input-section input:focus,
.input-section select:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.todos-filter {
    width: 100%;
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.todos-filter .btn-outline {
    border-color: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.todos-filter .btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background-color: rgba(255, 255, 255, 0.1);
}

.todos-filter .delete-all-btn {
    transition: all 0.3s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.todos-filter .delete-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.table-container {
    width: 100%;
    margin-bottom: 15px;
}

.alert-message {
    width: 100%;
    transition: all 0.3s ease;
    transform: scale(0.9);
    text-align: center;
}

.alert-message.show {
    display: block;
    transform: scale(1);
}

.alert-message.hide {
    display: none;
}

.theme-switcher {
    position: absolute;
    top: 16px;
    right: 16px;
}

.theme-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
}

.table th:first-child,
.table td:first-child {
    width: 35%;
    min-width: 120px;
}

.table th:last-child,
.table td:last-child {
    width: 25%;
    min-width: 120px;
}

.table th,
.table td {
    padding: 8px 4px;
    text-align: left;
}

/* Responsive table styles */
.table td {
    vertical-align: middle;
}

.table .btn {
    padding: 4px 8px;
    min-height: auto;
    height: auto;
}

.table .btn i {
    font-size: 14px;
}

.dropdown-content {
    background-color: #2a2a2a !important;
    color: #ffffff;
    opacity: 1 !important;
}

.dropdown-content li a {
    color: #ffffff !important;
    background-color: transparent;
}

.dropdown-content li a:hover {
    background-color: #3a3a3a !important;
    color: #ffffff !important;
}

/* Additional mobile enhancements */
.btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Responsive */
@media only screen and (max-width: 640px) {
    body {
        padding: 5px;
    }

    .container {
        margin: 0;
        padding: 10px;
        border-radius: 8px;
        min-height: calc(100vh - 10px);
    }

    .container header {
        padding: 15px 8px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 20px;
        margin-bottom: 10px;
        text-align: center;
        padding: 3px 0;
    }

    .input-section {
        gap: 12px;
        justify-content: center;
    }

    .todos-filter {
        margin-bottom: 15px;
        padding: 8px 0;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        flex-wrap: nowrap;
    }

    .todos-filter > div:first-child {
        order: 1;
        display: flex;
        flex-direction: row;
        gap: 12px;
        justify-content: flex-start;
        flex: 1;
    }

    .todos-filter .delete-all-btn {
        order: 2;
        align-self: center;
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
        margin-left: auto;
        flex-shrink: 0;
    }

    .table th,
    .table td {
        padding: 6px 2px;
        font-size: 12px;
    }

    .table .btn {
        padding: 2px 4px;
        margin: 1px;
    }

    .table .btn i {
        font-size: 12px;
    }

    .author-text {
        font-size: 10px;
        margin-bottom: 5px;
        position: fixed;
    }

    .theme-switcher {
        top: 5px;
        right: 5px;
        z-index: 1000;
    }

    .dropdown-content {
        width: 180px !important;
        font-size: 14px;
    }

    /* Hide less important columns on very small screens */
    .table th:nth-child(3),
    .table td:nth-child(3) {
        display: none;
    }

    /* Improve touch targets on mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-xs {
        min-height: 36px;
        min-width: 36px;
    }
    
    input, select {
        min-height: 44px;
    }
    
    /* Stack action buttons vertically on very small screens if needed */
    .table td:last-child .flex {
        justify-content: center;
    }

    /* Improved modal responsiveness */
    .modal-box {
        margin: 8px;
        width: calc(100vw - 16px);
        max-width: none;
    }

    /* Better dropdown positioning on mobile */
    .dropdown-content {
        position: fixed !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 200px !important;
        max-height: 200px;
        overflow-y: auto;
    }

    /* Ensure theme switcher is accessible on mobile */
    .theme-switcher .dropdown-content {
        right: 0 !important;
        left: auto !important;
        transform: none !important;
    }

    /* Mobile-specific button styling for icon-only buttons */
    .todos-filter .btn {
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
        align-items: center;
        padding: 8px;
    }

    .todos-filter .btn i {
        font-size: 18px;
        margin: 0;
    }

    /* Ensure buttons are properly sized for touch */
    .todos-filter .delete-all-btn {
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
        align-items: center;
    }

    /* Center the buttons in their container */
    .todos-filter > div:first-child {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 12px;
    }

    .todos-filter .dropdown {
        width: auto;
        flex: none;
    }
}

/* Enhanced mobile icon-only button styling */
@media (max-width: 640px) {
    .todos-filter .btn-outline {
        border-width: 2px;
        border-radius: 12px;
    }

    .todos-filter .btn-outline:hover {
        scale: 1.05;
        transition: all 0.2s ease;
    }

    .todos-filter .delete-all-btn {
        border-radius: 12px;
    }

    .todos-filter .delete-all-btn:hover {
        scale: 1.05;
        transition: all 0.2s ease;
    }
}

@media only screen and (max-width: 530px) {
    .container {
        margin-left: 5px;
        margin-right: 5px;
        max-width: 100%;
        min-width: 0;
    }

    .theme-swatch {
        width: 10px;
        height: 10px;
        margin-right: 4px;
    }
}

@media only screen and (min-width: 641px) and (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .container header {
        padding: 22px 15px;
        margin-bottom: 22px;
    }

    header h1 {
        font-size: 26px;
        text-align: center;
        margin-bottom: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .todos-filter {
        padding: 12px 0;
    }

    .todos-filter .btn {
        min-width: 120px;
    }
}

@media only screen and (min-width: 768px) {
    .container {
        padding: 30px;
    }

    .container header {
        padding: 25px 20px;
        margin-bottom: 30px;
    }

    header h1 {
        font-size: 32px;
        text-align: center;
        margin-bottom: 18px;
        padding: 8px 0;
    }

    .input-section {
        margin-bottom: 25px;
        gap: 24px;
    }

    .todos-filter {
        margin-bottom: 25px;
        padding: 15px 0;
    }

    .table-container {
        margin-bottom: 20px;
    }

    .theme-switcher {
        top: 20px;
        right: 20px;
    }

    .theme-swatch {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    .table th,
    .table td {
        padding: 12px 8px;
        font-size: 14px;
    }

    .table .btn {
        padding: 6px 12px;
    }

    .table .btn i {
        font-size: 16px;
    }

    .todos-filter .btn {
        min-width: 130px;
    }

    .todos-filter .delete-all-btn {
        min-width: 140px;
    }
}

/* Ensure proper left-right alignment */
.todos-filter > div:first-child {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

@media (min-width: 768px) {
    .todos-filter > div:first-child {
        gap: 16px;
    }
}

/* Improved modal responsiveness for larger screens */
.modal-box {
    margin: 16px;
}

/* Force responsive text visibility for buttons */
.todos-filter .btn .btn-text {
    display: none;
}

@media (min-width: 640px) {
    .todos-filter .btn .btn-text {
        display: inline;
        margin-left: 8px;
    }
}

/* Ensure icon-only buttons work properly on small screens */
@media (max-width: 639px) {
    .todos-filter .btn .btn-text {
        display: none !important;
    }
    
    .todos-filter .btn {
        min-width: 48px !important;
        width: 48px;
        height: 48px;
        padding: 8px !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .todos-filter .btn i {
        margin: 0 !important;
        font-size: 18px !important;
    }
}

/* Better mobile layout for buttons */
@media (max-width: 639px) {
    .todos-filter {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .todos-filter > div:first-child {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px !important;
        justify-content: flex-start !important;
        flex: 1 !important;
        order: 1 !important;
    }

    .todos-filter .delete-all-btn {
        order: 2 !important;
        margin-left: auto !important;
        flex-shrink: 0 !important;
        align-self: center !important;
    }
}
