/* css/components.css */

/* =========================================
   D. Buttons & Forms
   ========================================= */
.btn-primary {
    background-color: var(--accent-primary);
    color: #ffffff;
    padding: 10px 15px;
    border-radius: var(--radius-md);
    font-weight: bold;
    transition: filter 0.2s;
}
.btn-primary:hover { background-color: var(--accent-hover); }

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
    padding: 10px 15px;
    border-radius: var(--radius-md);
    font-weight: bold;
    transition: filter 0.2s;
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 15px;
    border-radius: var(--radius-md);
    font-weight: bold;
    transition: border-color 0.2s, color 0.2s;
}
.btn-outline:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Standard Inputs reused in Apps */
.app-input, .app-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    margin-bottom: 10px;
}
.app-input:focus, .app-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* =========================================
   E. Modals (Global & App Specific)
   ========================================= */
/* Target native dialog elements */
dialog {
    margin: auto;
    border: none;
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    width: 90%;
    max-width: 500px;
    padding: 0;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.settings-section { margin-bottom: 20px; }
.settings-section h4 { 
    margin-bottom: 10px; 
    color: var(--accent-primary); 
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: bold;
}
input[type="color"] {
    cursor: pointer;
    border: none;
    background: none;
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 4px;
}

/* =========================================
   F. Standardized App Cards
   ========================================= */
.app-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

/* Standardized Tables */
.app-table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.app-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.app-table th, .app-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.app-table th {
    background-color: rgba(0,0,0,0.03);
    font-weight: bold;
}
[data-theme="dark"] .app-table th { background-color: rgba(255,255,255,0.03); }

/* =========================================
   G. Toast Notifications
   ========================================= */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none; /* Let clicks pass through if empty */
}

.toast {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    border-left: 5px solid var(--accent-primary);
    box-shadow: var(--shadow-md);
    min-width: 250px;
    pointer-events: auto; /* Catch clicks on the toast itself */
    
    /* Animation timing handles the fade out automatically */
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, 
               toastFadeOut 0.4s ease forwards 2.7s;
}

.toast.error {
    border-left-color: var(--danger-color);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastFadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}