/*
Plugin Stylesheet: profit-calendar.css
Description: Styles for the monthly profit/loss calendar with responsive scrolling.
*/

/* Base calendar container and general styles */
.profit-calendar {
    max-width: 900px;
    margin: 40px auto;
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 30px;
    /* Ensure the main container doesn't overflow itself */
    overflow: hidden; 
}

/* Form layout */
.calendar-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
    justify-content: space-between;
}

.calendar-form label {
    font-weight: 500;
    color: #374151;
}

.calendar-form select,
.calendar-form input[type="submit"] {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.calendar-form select:focus,
.calendar-form input[type="submit"]:focus {
    border-color: #4f46e5;
    outline: none;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.calendar-form input[type="submit"] {
    background: #4f46e5;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.calendar-form input[type="submit"]:hover {
    background: #4338ca;
}

/* Calendar Header */
.profit-calendar h3 {
    text-align: center;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

/* Error Message */
.error {
    color: #ef4444;
    background: #fee2e2;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
    text-align: center;
}

/* ---------------------------------------------------- */
/* 🌟 RESPONSIVE SCROLL LOGIC 🌟 */
/* ---------------------------------------------------- */

/* 1. Wrapper (Default): Prevents scroll on large screens. */
.calendar-wrapper {
    width: 100%;
    margin-top: 10px;
    overflow-x: hidden; 
    -webkit-overflow-scrolling: touch; 
}

/* 2. Table: Forces the table to be wide enough to require scrolling on small screens. */
.calendar-table {
    min-width: 800px; 
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden; 
}

/* 3. Media Query: Enables horizontal scroll ONLY when viewport is 960px or smaller. */
@media (max-width: 960px) {
    .calendar-wrapper {
        overflow-x: auto; /* Activates the scroll on mobile, landscape, and tablets */
    }
}

/* ---------------------------------------------------- */

/* Table headers */
.calendar-table th {
    background-color: #f8fafc;
    color: #334155;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.05em;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* Table cells */
.calendar-table td {
    padding: 16px;
    text-align: center;
    border: 1px solid #f1f5f9;
    vertical-align: middle;
    transition: background 0.2s ease, transform 0.1s ease;
    cursor: pointer;
    background-color: #ffffff;
    /* Helps manage your multi-line data in small cells */
    word-break: break-all;
}

.calendar-table td:hover {
    background-color: #f9fafb;
    transform: scale(1.02);
}

/* Profit and Loss coloring */
.calendar-table td.profit {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-weight: 600;
    border: none;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.calendar-table td.loss {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-weight: 600;
    border: none;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

/* Optional scrollbar styling for better appearance on Chrome/Safari */
.calendar-wrapper::-webkit-scrollbar {
    height: 8px;
}
.calendar-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(79, 70, 229, 0.3);
    border-radius: 4px;
}
.calendar-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
}
