/* General Body and Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0; /* Remove default margin */
    padding: 0;
    background-color: #f4f7f9; /* Lighter background */
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensure footer stays at bottom */
}

/* Header Styles */
header {
    background-color: #0056b3; /* Darker blue */
    color: white;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0 0 5px 0;
    font-size: 1.8em;
    font-weight: 600;
}

header p {
    margin: 0;
    font-size: 0.95em;
    opacity: 0.9;
}

/* Main Content Area */
main {
    flex: 1; /* Allow main to grow and push footer down */
    max-width: 1200px; /* Limit content width for better readability */
    margin: 20px auto; /* Center content horizontally with margin */
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    width: calc(100% - 40px); /* Account for padding */
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Placeholder styles */
#desktop-placeholder-table {
    display: none;
}

#mobile-placeholder-table {
    display: none;
}

.placeholder-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.placeholder-row {
    border: 1px solid #dee2e6;
    margin-bottom: 15px;
    background-color: #fff !important;
    border-radius: 4px;
    padding: 10px;
}

.placeholder-cell {
    border: none;
    border-bottom: 1px solid #eee;
    position: relative;
    padding-left: 45%;
    padding-top: 8px;
    padding-bottom: 8px;
    white-space: normal;
    text-align: left;
    min-height: 30px;
    display: flex;
    align-items: center;
}

.placeholder-content {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: placeholder-loading 1.5s infinite;
    height: 20px;
    border-radius: 4px;
}

@keyframes placeholder-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Loading and Error States */
#loading, #error, #no-data {
    text-align: center;
    padding: 30px 20px;
    font-size: 1.1em;
    border-radius: 5px;
    margin: 20px 0;
}

#loading {
    color: #0056b3; /* Blue */
    background-color: #e7f0f7;
    border: 1px solid #b3d1ec;
}

#error {
    color: #721c24; /* Dark red */
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    font-weight: bold;
}
#no-data {
    color: #666;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
}


/* Filter Controls Section */
#filter-controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa; /* Light grey background */
    border: 1px solid #e9ecef;
    border-radius: 5px;
    display: flex; /* Use flexbox for alignment */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 15px; /* Space between filter elements */
    align-items: center; /* Vertically align items */
}

#filter-controls label {
    font-weight: 600; /* Slightly bolder */
    margin-right: 5px;
    white-space: nowrap; /* Prevent label text wrapping */
}

#filter-controls select {
    padding: 8px 12px; /* More padding */
    border-radius: 4px;
    border: 1px solid #ced4da; /* Standard input border color */
    background-color: #fff;
    cursor: pointer;
    min-width: 150px; /* Give select boxes some minimum width */
    flex-grow: 1; /* Allow select boxes to grow */
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 0 5px rgba(0,0,0,0.05); /* Subtle shadow */
}

th, td {
    border: 1px solid #dee2e6; /* Lighter border color */
    padding: 12px 15px; /* Increased padding */
    text-align: left;
    font-size: 0.9em;
    vertical-align: middle; /* Align cell content vertically */
}

thead th { /* Changed from 'th' to be more specific */
    background-color: #343a40; /* Dark background for header */
    color: white;
    position: sticky;
    top: 0; /* Stick header to top when scrolling */
    z-index: 10; /* Ensure header stays above content */
    font-weight: 600; /* Bolder header text */
    white-space: nowrap; /* Prevent header text wrapping */
}

tbody tr:nth-child(even) {
    background-color: #f8f9fa; /* Very light grey for even rows */
}

tbody tr:hover {
    background-color: #e9ecef; /* Slightly darker hover effect */
}

td a {
    color: #0056b3; /* Link color matching header */
    text-decoration: none;
    font-weight: 500;
}
td a:hover {
    text-decoration: underline;
    color: #003d80; /* Darker blue on hover */
}

/* Footer Styles */
footer {
    text-align: center;
    margin-top: 30px; /* More space above footer */
    padding: 15px;
    background-color: #e9ecef; /* Light grey footer */
    color: #6c757d; /* Grey text color */
    font-size: 0.85em;
    border-top: 1px solid #dee2e6;
}

footer p {
    margin: 0;
}

footer #last-updated {
    font-weight: 600;
}

/* Admin Panel Specific Styles (admin.html) */
#admin-controls .action-group {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
#admin-controls .action-group:last-of-type {
    border-bottom: none; /* Remove border from last group */
    margin-bottom: 0;
}

#admin-controls .action-group h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #495057; /* Darker grey for subheading */
    font-size: 1.1em;
}

#admin-controls button {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
    margin-right: 10px;
    margin-bottom: 10px; /* Space below buttons */
}

#admin-controls button:hover {
    background-color: #0056b3;
}

#admin-controls button:disabled {
    background-color: #adb5bd; /* Grey out disabled buttons */
    cursor: not-allowed;
    opacity: 0.7;
}

#admin-controls .description {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
    margin-left: 5px; /* Indent description slightly */
}

#status-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

#status-section h3 {
     margin-bottom: 10px;
}


#status-output {
    background-color: #e9ecef; /* Match footer/filter background */
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; /* Monospace font */
    min-height: 60px; /* Ensure some height */
    border: 1px solid #dee2e6; /* Match table border */
    font-size: 0.85em;
    line-height: 1.5;
    max-height: 400px; /* Prevent excessively long output */
    overflow-y: auto; /* Add scroll if content overflows */
}

/* Add specific styles for success and error messages within the output */
#status-output.success-message {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

#status-output.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* Responsive Table Adjustments */
@media screen and (min-width: 769px) {
    #desktop-placeholder-table.loading {
        display: table;
    }
}

@media screen and (max-width: 768px) {
    #mobile-placeholder-table.loading {
        display: block;
    }

    main {
        padding: 15px;
        width: calc(100% - 30px);
    }

    header h1 {
        font-size: 1.5em;
    }

    #filter-controls {
        flex-direction: column; /* Stack filters vertically */
        align-items: stretch; /* Make items full width */
        gap: 10px;
    }
    #filter-controls label {
       margin-left: 0 !important;
       margin-bottom: 3px; /* Space below label */
    }
     #filter-controls select {
         min-width: unset; /* Remove min-width */
     }


    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    tr {
        border: 1px solid #dee2e6;
        margin-bottom: 15px; /* More space between rows */
        background-color: #fff !important; /* Override alternating background */
        border-radius: 4px; /* Slightly round corners */
        padding: 10px; /* Add padding inside the row block */
     }
    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 45%; /* Adjust based on label width */
        padding-top: 8px;
        padding-bottom: 8px;
        white-space: normal;
        text-align: left;
        min-height: 30px; /* Ensure cells have some height */
        display: flex; /* Use flex to align label and content */
        align-items: center;
    }
    td:last-child {
        border-bottom: none; /* Remove border from last cell in a row */
    }
    td:before {
        position: absolute;
        top: 50%;
        left: 10px; /* More space from left edge */
        width: 40%; /* Adjust label width */
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600; /* Bolder labels */
        color: #495057; /* Darker label color */
        transform: translateY(-50%);
        content: attr(data-label); /* Use data-label */
    }
     /* Assign labels - Ensure these match the columns in index.html */
     td:nth-of-type(1):before { content: "PDF"; }
     td:nth-of-type(2):before { content: "Hız"; }
     td:nth-of-type(3):before { content: "Taahhüt"; }
     td:nth-of-type(4):before { content: "Ort. Aylık ₺"; }
     td:nth-of-type(5):before { content: "Toplam ₺"; }
     td:nth-of-type(6):before { content: "Fiyat Detayı"; }
     td:nth-of-type(7):before { content: "Liste Fiyatı ₺"; }

      /* Adjust padding for link cell to prevent overlap */
      td:nth-of-type(1) {
         padding-top: 12px;
         padding-bottom: 12px;
      }
       /* Adjust padding for multi-line price details */
      td:nth-of-type(6) {
         padding-top: 12px;
         padding-bottom: 12px;
         align-items: flex-start; /* Align label to top if content wraps */
      }
       td:nth-of-type(6):before {
          top: 12px; /* Align label with first line */
          transform: none;
       }
}
