/**
 * Glykotexnies Orders Grid Styles
 * 
 * Main stylesheet for the orders table and grid view
 */

/***************************************
 * 1. CORE CONTAINER AND CONTROLS
 ***************************************/

/* Container and controls */
.orders-container {
    max-width: 100%;
    padding: 20px;
}

.orders-controls {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    width: 100%;
}

/* Buttons */
.mark-ready-button,
.toggle-button {
    background-color: #007cba;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: normal;
    transition: all 0.3s ease;
    text-transform: none;
    margin-bottom: 10px;
}

.mark-ready-button:hover,
.toggle-button:hover {
    background-color: #495057;
}

.toggle-button.active {
    background-color: #495057;
}

/***************************************
 * 2. FILTERS STYLES
 ***************************************/

/* Filter labels - Not used anymore but kept for compatibility */
.filter-container label {
    display: none;
}

/* Filter inputs (common styles) */
.filter-control {
    padding: 0 15px;
    border: 2px solid #007cba;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    height: 40px;
    width: 100%;
}

.filter-control:focus {
    outline: none;
    border-color: #495057;
}

/* Search input focus style to match filters */
.search-input:focus {
    outline: none;
    border-color: #495057;
    box-shadow: 0 0 0 3px rgba(203, 153, 126, 0.1);
}

/* Specific filter input styles */
.date-filter,
.status-filter {
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1.2em;
}

.date-filter {
    padding-right: 35px; /* Space for clear button */
}

/* Print button styles */
.print-daily-button {
    background-color: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 4px;
    width: 45px;
    height: 45px;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    transition: all 0.3s ease;
    vertical-align: middle;
    opacity: 0.5;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG icon styling */
.print-daily-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.clear-all-filters-button svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.print-daily-button.active {
    background-color: #007cba;
    color: white;
    border-color: #007cba;
    opacity: 1;
}

.print-daily-button:disabled {
    cursor: not-allowed;
    border-color: #ddd;
}

.print-daily-button:not(:disabled):hover {
    background-color: #007cba;
    color: white;
    border-color: #007cba;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(203,153,126,0.25);
}

.print-daily-button:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(203,153,126,0.25);
}

/* Button ripple effect */
.print-daily-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

.print-daily-button:not(:disabled):active::after {
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}

.date-filter {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b705c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3e%3c/rect%3e%3cline x1='16' y1='2' x2='16' y2='6'%3e%3c/line%3e%3cline x1='8' y1='2' x2='8' y2='6'%3e%3c/line%3e%3cline x1='3' y1='10' x2='21' y2='10'%3e%3c/line%3e%3c/svg%3e");
    padding-right: 40px; /* Space for clear button */
}

.status-filter {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b705c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.status-filter option {
    padding: 10px;
    font-size: 15px;
}

/* Selected states */
.date-filter.date-selected,
.status-filter.status-selected {
    background-color: #f9e9ef;
    border-color: #007cba;
    color: #007cba;
    font-weight: bold;
}

/* Filter containers - 75% width with internal distribution */
.filters-wrapper {
    flex: 0 0 75%;
    display: flex;
    flex-wrap: nowrap;
    gap: 1%;
    align-items: flex-start;
}

.filter-container {
    position: relative;
}

/* Date filter container - 31% of filters-wrapper */
.date-filter-container {
    flex: 0 0 31%;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Date stats container - 31% of filters-wrapper */
.date-stats-container {
    flex: 0 0 31%;
}

/* Status filter container - 31% of filters-wrapper */
.status-filter-container {
    flex: 0 0 31%;
}

/* Clear all container - 7% of filters-wrapper */
.clear-all-container {
    flex: 0 0 7%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Clear/reset buttons */
.clear-date-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 16px;
    line-height: 1;
    color: #007cba;
    cursor: pointer;
    padding: 0;
    z-index: 2;
}

.clear-date-button:hover {
    color: #495057;
}

.clear-all-filters-button {
    background-color: #f5f5f5;
    color: #007cba;
    border: 2px solid #007cba;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.print-daily-button {
    background-color: #f5f5f5;
    color: #007cba;
    border: 2px solid #007cba;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-all-filters-button:hover,
.print-daily-button:hover:not(:disabled) {
    background-color: #007cba;
    color: white;
}

.print-daily-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ddd;
}

/* Icon sizing */
.clear-all-filters-button svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.print-daily-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/***************************************
 * 3. DATEPICKER STYLING
 ***************************************/

/* Datepicker container */
.ui-datepicker {
    background-color: white;
    border: 2px solid #007cba;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(203, 153, 126, 0.2);
    padding: 12px;
    font-family: inherit;
    font-size: 15px;
    width: 320px !important;
    z-index: 100 !important;
}

/* Header area with month/year */
.ui-datepicker-header {
    background-color: #007cba;
    color: white;
    padding: 10px 5px;
    border-radius: 6px;
    position: relative;
    margin-bottom: 8px;
}

.ui-datepicker-title {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 0.5px;
}

/* Navigation arrows */
.ui-datepicker-prev,
.ui-datepicker-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    padding: 5px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.ui-datepicker-prev {
    left: 5px;
}

.ui-datepicker-next {
    right: 5px;
}

/* Calendar table */
.ui-datepicker-calendar {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
}

/* Day headers */
.ui-datepicker-calendar th {
    padding: 8px 5px;
    text-align: center;
    font-weight: bold;
    color: #007cba;
    font-size: 12px;
}

/* Day cells */
.ui-datepicker-calendar td {
    padding: 2px;
    text-align: center;
}

.ui-datepicker-calendar a {
    display: block;
    padding: 8px 5px;
    text-decoration: none;
    color: #333;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: normal;
}

.ui-datepicker-calendar a:hover {
    background-color: #f9e9ef;
}

/* Special date states */
.ui-datepicker-calendar .ui-state-active {
    background-color: #007cba;
    color: white;
    font-weight: bold;
}

.ui-datepicker-calendar .ui-state-highlight {
    background-color: #f7dde5;
    border: 1px solid #007cba;
    color: #007cba;
    font-weight: bold;
}

.ui-datepicker-today a {
    font-weight: bold;
}

/***************************************
 * 4. SEARCH AND FILTERS LAYOUT
 ***************************************/

/* Hidden actions container (kept for compatibility) */
.orders-actions {
    display: none;
}

/* Search and filters container */
.orders-controls {
    margin-bottom: 20px;
    width: 100%;
}

/* Unified search and filters layout - Desktop: single row */
.search-filter-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    width: 100%;
    align-items: flex-start;
}

/* Search input - 25% width */
.search-container {
    flex: 0 0 25%;
    position: relative;
}

.search-input {
    padding: 0 15px 0 40px;
    width: 100%;
    border: 2px solid #007cba;
    border-radius: 4px;
    height: 40px;
    font-size: 16px;
    background-color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b705c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cline x1='21' y1='21' x2='16.65' y2='16.65'%3e%3c/line%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 20px;
}

.search-input:focus {
    outline: none;
    border-color: #495057;
}


/***************************************
 * 6. CARD GRID VIEW (PRIMARY VIEW)
 ***************************************/

/* Grid container */
.orders-grid {
    display: none; /* Initially hidden, shown via JavaScript */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
}

/* Order card base styles */
.order-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    border-left-width: 10px;
}

/* Hover effects */
.order-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.order-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 80%, rgba(255,255,255,0.1) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.order-card:hover::after {
    opacity: 1;
}

/* Card header with order number and status */
.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.order-number {
    font-weight: bold;
    font-size: 16px;
}

.order-status {
    background-color: #ddd;
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 14px;
    font-weight: 500;
}

/* Card body with order details */
.order-card-body {
    padding: 15px;
}

.order-detail {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-weight: bold;
    color: #555;
    font-size: 12px;
    margin-bottom: 2px;
}

.detail-value {
    font-size: 14px;
}

/* Emphasis on important information */
.order-detail:nth-child(1) .detail-value,  /* Name */
.order-detail:nth-child(4) .detail-value { /* Pickup date */
    font-size: 18px;
    font-weight: bold;
    color: #222;
    padding: 3px 0;
}

.order-detail:nth-child(4) {
    border-left: 3px solid #007cba;
    padding-left: 8px;
    margin: 5px 0 10px;
}

/* Card footer with actions */
.order-card-footer {
    padding: 12px 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.edit-order-button {
    display: flex;
    align-items: center;
    background-color: #007cba;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.edit-order-button:hover {
    background-color: #495057;
    color: white;
}

.edit-icon-small {
    width: 16px;
    height: 16px;
    fill: white;
    margin-right: 6px;
}

/***************************************
 * 7. STATUS-BASED STYLING
 ***************************************/

/* Printed order indicator styling */
.order-card.printed-order {
    position: relative;
}

.order-card.printed-order::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #4caf50;
    z-index: 1;
}

.printed-icon {
    display: inline-block;
    margin-left: 5px;
    font-size: 14px;
    position: relative;
    top: -1px;
    cursor: help;
}

/* Status styling for grid cards */

/* Received status - Παραλήφθηκε (paralifthike) */
.order-card.status-received .order-card-header {
    background-color: #ffe199; /* Stronger yellow highlight */
}

.order-card.status-received .order-status {
    background-color: #ffcc00;
    color: #000;
    font-weight: bold;
}

.order-card.status-received {
    border-left-color: #ffcc00;
    background-color: #fffaed;
}

/* Baking status - Στο φούρνο (sto_fourno) */
.order-card.status-baking .order-card-header {
    background-color: #ffd699; /* Orange highlight */
}

.order-card.status-baking .order-status {
    background-color: #ff9933;
    color: #000;
    font-weight: bold;
}

.order-card.status-baking {
    border-left-color: #ff9933;
    background-color: #fff6ec;
}

/* Ready status - Έτοιμη (etoimi) */
.order-card.status-ready .order-card-header {
    background-color: #c8e6c9; /* Green highlight */
}

.order-card.status-ready .order-status {
    background-color: #4caf50;
    color: white;
    font-weight: bold;
}

.order-card.status-ready {
    border-left-color: #4caf50;
    background-color: #f0f8f0;
}

/* Canceled status - Ακυρώθηκε (akirothike) */
.order-card.status-canceled .order-card-header {
    background-color: #f5f5f5; /* Gray highlight */
}

.order-card.status-canceled .order-status {
    background-color: #9e9e9e;
    color: white;
    font-weight: bold;
}

.order-card.status-canceled {
    border-left-color: #9e9e9e;
    background-color: #f8f8f8;
    opacity: 0.85;
}


/***************************************
 * 8. ICON STYLING AND TOOLTIPS (LEGACY)
 ***************************************/

/* Legacy icon styles for table view */
.edit-icon {
    width: 48px;
    height: 48px;
    fill: #007cba;
    vertical-align: middle;
    transition: fill 0.3s ease, transform 0.2s ease;
}

.edit-icon:hover {
    fill: #495057;
    transform: scale(1.1);
}

.trash-icon {
    width: 48px;
    height: 48px;
    fill: #454545;
    vertical-align: middle;
}

/* Tooltip functionality - applied to any element with title attribute */
[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/***************************************
 * 9. RESPONSIVE DESIGN RULES
 ***************************************/

/* All screens - hide table, show grid */
.orders-table-wrapper {
    display: none; /* Always hide the table view */
}

.orders-grid {
    display: grid; /* Always use grid view */
    grid-template-columns: repeat(3, 1fr); /* 3 columns on desktop */
    gap: 20px;
    margin-top: 15px;
}

/* Medium screens (tablets) - 2 column grid */
@media screen and (max-width: 1200px) {
    .orders-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet and desktop layout */
@media screen and (min-width: 769px) {
    .date-filter {
        padding-right: 30px; /* Make room for clear button */
    }
}

/* Medium screens (tablets) - simple layout */
@media screen and (max-width: 1200px) and (min-width: 769px) {
    /* Grid adjustments */
    .orders-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small screens (phones) - simple mobile layout */
@media screen and (max-width: 768px) {
    /* Single column grid */
    .orders-grid {
        grid-template-columns: 1fr;
    }
    
    /* Ensure buttons have enough room */
    .filter-control {
        padding-right: 30px;
    }
}

/***************************************
 * 10. DATE STATISTICS DISPLAY
 ***************************************/

/* Date statistics container */
.date-stats-container {
    width: 100%;
    margin: 0;
    animation: fadeIn 0.3s ease;
}

.date-stats-box {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #005a87;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-wrap: break-word;
    line-height: 1.2;
}

.date-stats-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.date-stats-box:hover::before {
    left: 100%;
}

#date-stats-text {
    display: block;
    position: relative;
    z-index: 1;
}

/* Animation for showing stats */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive adjustments */
@media screen and (max-width: 768px) {
    /* Stack layout vertically on mobile */
    .search-filter-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-container {
        flex: 1 1 100%;
        width: 100%;
    }
    
    .filters-wrapper {
        flex: 1 1 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .date-filter-container,
    .date-stats-container,
    .status-filter-container {
        flex: 1 1 100%;
        width: 100%;
    }
    
    .clear-all-container {
        flex: 1 1 100%;
        justify-content: center;
    }
    
    .date-stats-box {
        padding: 10px 15px;
        font-size: 12px;
        margin: 0;
        height: auto;
        min-height: 40px;
    }
}

/* Tablet responsive adjustments */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .search-container {
        flex: 0 0 30%;
    }
    
    .filters-wrapper {
        flex: 0 0 70%;
    }
    
    .date-filter-container,
    .date-stats-container,
    .status-filter-container {
        flex: 0 0 30%;
    }
    
    .clear-all-container {
        flex: 0 0 10%;
    }
    
    .date-stats-box {
        font-size: 11px;
        padding: 6px 8px;
    }
}

/***************************************
 * 11. MULTI-PHOTO DISPLAY STYLES
 ***************************************/

/* Photo display wrapper for multiple photos */
.photo-display-wrapper {
    position: relative;
    display: inline-block;
}

.photo-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: rgba(0, 124, 186, 0.9);
    color: white;
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.photo-count {
    font-size: 10px;
}

.photo-icon {
    font-size: 9px;
}

/* Photo carousel modal styles */
.photo-carousel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.photo-carousel-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 6%;
    max-width: 100vw;
    max-height: 87vh;
	height: 80%;
}

.carousel-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
}

.carousel-image.loading {
    opacity: 0.5;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.carousel-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: -70px;
}

.carousel-next {
    right: -70px;
}

.carousel-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.carousel-close:hover {
    background: white;
    transform: scale(1.1);
}

.carousel-info {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Mobile responsive adjustments for carousel */
@media screen and (max-width: 768px) {
    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .carousel-prev {
        left: -50px;
    }
    
    .carousel-next {
        right: -50px;
    }
    
    .carousel-close {
        width: 35px;
        height: 35px;
        font-size: 16px;
        top: -45px;
    }
    
    .carousel-info {
        font-size: 12px;
        padding: 6px 12px;
        bottom: -40px;
    }
}