/* --- Global Dark Mode & Font --- */
.ptd-dark-mode {
    font-family: 'Anek Bangla', sans-serif;
    background-color: #2C3E50; 
    color: #e0e0e0;
    border: 1px solid #566573; 
    border-radius: 12px;
    padding: 25px;
    margin: 20px 0;
    overflow: hidden;
}
.ptd-container-logged-out {
    font-family: 'Anek Bangla', sans-serif;
    border: 1px solid #e6a800;
    background: #2b2100;
    color: #ffd966;
    padding: 25px;
    text-align: center;
    border-radius: 12px;
}
.ptd-container-logged-out a {
    color: #ffffff;
    font-weight: bold;
    text-decoration: underline;
}

/* --- Header: Search & Favorites --- */
.ptd-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}
.ptd-search-wrapper {
    flex-grow: 1;
    position: relative;
    min-width: 250px;
}
#ptd-search-bar {
    width: 100%;
    padding: 14px 20px 14px 50px;
    font-size: 16px;
    border: 1px solid #566573; 
    border-radius: 30px;
    background-color: #34495E; 
    color: #f0f0f0;
    font-family: 'Anek Bangla', sans-serif; 
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23888" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: 18px center;
}
#ptd-search-bar:focus {
    border-color: #28a745; 
    background-color: #34495E;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3); 
}

/* --- Category Buttons --- */
.ptd-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #566573;
}
.ptd-categories:empty {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.ptd-cat-btn {
    font-family: 'Anek Bangla', sans-serif; 
    background-color: #34495E; 
    color: #d0d0d0;
    border: 1px solid #566573; 
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 400;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ptd-cat-btn:hover {
    background-color: #4A6572; 
    color: #ffffff;
    border-color: #76899E;
}
.ptd-cat-btn.active {
    background-color: #28a745; 
    color: #ffffff;
    font-weight: bold;
    border-color: #28a745; 
}
.ptd-header .ptd-cat-btn[data-slug="favorites"] { 
    background-color: #8c2cff;
    border-color: #8c2cff;
    color: white;
    font-weight: bold;
}
.ptd-header .ptd-cat-btn[data-slug="favorites"]:hover {
    background-color: #a35eff;
}
.ptd-header .ptd-cat-btn[data-slug="favorites"].active {
    background-color: #2ecc71; 
    border-color: #2ecc71;
    color: #ffffff;
}
.ptd-cat-btn svg {
    vertical-align: middle;
}

/* --- *** ADDED: "Add New Task" Button Style *** --- */
#ptd-add-task-btn {
    background-color: #28a745;
    border-color: #28a745;
    color: #ffffff;
    font-weight: bold;
}
#ptd-add-task-btn:hover {
    background-color: #218838;
    border-color: #218838;
}

/* --- Card Grid --- */
#ptd-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    min-height: 100px;
}
.ptd-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    background-color: #34495E; 
    border-radius: 12px;
    border: 1px solid #566573; 
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
}
.ptd-card-link:hover {
    transform: translateY(-5px);
    border-color: #76899E; 
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.ptd-card-body {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-top: 25px; 
}
.ptd-card-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background-color: #2C3E50; 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 0;
}
.ptd-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ptd-card-content {
    flex-grow: 1; 
}
.ptd-card-content h3 {
    font-size: 1.3em;
    font-weight: 700;
    color: #ffffff;
    margin-top: 0; 
    margin-bottom: 10px;
}
.ptd-card-content p {
    font-size: 1em;
    color: #b0b0b0;
    margin-bottom: 0;
    line-height: 1.6;
}
.ptd-badge-container {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: row; 
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    z-index: 2; 
}
.ptd-badge {
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}
.ptd-badge-premium { background-color: #ffc107; color: #1a1b1e; }
.ptd-badge-free { background-color: #28a745; color: #ffffff; }
.ptd-badge-new { background-color: #0084ff; color: #ffffff; }

/* *** MODIFIED: Fav btn and Click Count *** */
.ptd-card-top-left {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 3;
}
.ptd-fav-btn {
    /* position: absolute; REMOVED */
    /* top: 15px;       REMOVED */
    /* left: 15px;      REMOVED */
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 24px;
    padding: 0;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    /* z-index: 3;      REMOVED (moved to parent) */
}
.ptd-fav-btn:hover { color: #ccc; transform: scale(1.1); }
.ptd-fav-btn.is-favorite { color: #ff4757; }

/* *** ADDED: Click Count Style *** */
.ptd-click-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #aaa;
    background-color: rgba(44, 62, 80, 0.7); 
    padding: 3px 8px;
    border-radius: 15px;
    line-height: 1;
    font-weight: 400;
}
.ptd-click-count svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
/* *** END MODIFICATION *** */

.ptd-loader, .ptd-no-results, .ptd-error {
    text-align: center;
    padding: 50px 20px;
    color: #888;
    font-size: 1.1em;
    grid-column: 1 / -1; 
}
.ptd-error { color: #ff4757; }
.ptd-load-more-wrapper {
    text-align: center;
    margin-top: 30px;
}
#ptd-load-more-btn {
    font-family: 'Anek Bangla', sans-serif;
    background-color: #28a745;
    color: #ffffff;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}
#ptd-load-more-btn:hover { background-color: #218838; }
#ptd-load-more-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- Modern Popup (Modal) --- */
#ptd-popup-modal, #ptd-add-task-modal { /* *** ADDED: New Modal ID *** */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none; 
    align-items: center;
    justify-content: center;
}
#ptd-popup-modal.active, #ptd-add-task-modal.active { /* *** ADDED: New Modal ID *** */
    display: flex;
}
.ptd-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}
.ptd-popup-content {
    position: relative;
    background: #34495E; 
    border: 1px solid #566573; 
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10001;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: ptd-popup-fadein 0.3s ease-out;
}
.ptd-popup-body {
    padding: 30px 35px;
}
.ptd-popup-body p {
    color: #e0e0e0;
    line-height: 1.7;
}
.ptd-popup-body a {
    color: #00aaff;
    font-weight: bold;
    text-decoration: none;
}
.ptd-popup-body a:hover { text-decoration: underline; }

.ptd-modal-close-btn { /* *** CHANGED: Generic class for close buttons *** */
    position: absolute;
    top: 15px;
    right: 15px;
    background: #566573; 
    border: none;
    color: #e0e0e0;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 28px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}
.ptd-modal-close-btn:hover {
    background: #ff4757;
    color: #fff;
}
.ptd-popup-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin-top: 25px; 
    background-color: #28a745; 
    color: #ffffff !important; 
    text-decoration: none;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    transition: background-color 0.3s;
    box-sizing: border-box; 
    border: none; /* *** ADDED: for button element *** */
    cursor: pointer; /* *** ADDED: for button element *** */
}
.ptd-popup-btn:hover {
    background-color: #218838; 
    text-decoration: none;
    color: #ffffff !important;
}
.ptd-popup-btn:disabled {
    background-color: #566573;
    opacity: 0.7;
    cursor: wait;
}

/* --- *** ADDED: New Task Form Styles *** --- */
.ptd-modal-title {
    margin-top: 0;
    color: #ffffff;
}
#ptd-add-task-form p {
    font-size: 0.9em;
    color: #b0b0b0;
    margin-bottom: 20px;
}
.ptd-form-group {
    margin-bottom: 15px;
}
.ptd-form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #e0e0e0;
}
.ptd-form-group input[type="text"],
.ptd-form-group input[type="url"],
.ptd-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
    border: 1px solid #566573;
    border-radius: 8px;
    background-color: #2C3E50;
    color: #f0f0f0;
    font-family: 'Anek Bangla', sans-serif;
    box-sizing: border-box;
}
.ptd-form-group input[type="text"]:focus,
.ptd-form-group input[type="url"]:focus,
.ptd-form-group textarea:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
    outline: none;
}
.ptd-form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.ptd-required {
    color: #ff4757;
}
#ptd-add-task-messages {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    display: none;
    font-weight: bold;
}
#ptd-add-task-messages.ptd-add-task-success {
    display: block;
    background-color: #28a745;
    color: #ffffff;
}
#ptd-add-task-messages.ptd-add-task-error {
    display: block;
    background-color: #ff4757;
    color: #ffffff;
}

@keyframes ptd-popup-fadein {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}