/* General Styling for the Plugin Container */
.google-keyword-planner-container {
    font-family: 'Inter', sans-serif; /* Modern font */
    background: linear-gradient(145deg, #ffffff, #f0f2f5); /* Subtle gradient background */
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); /* Deeper shadow */
    padding: 30px;
    max-width: 900px; /* Max width for better readability on large screens */
    margin: 30px auto; /* Center on page with margin */
    border: 1px solid #e0e0e0;
    color: #333;
    animation: fadeIn 0.5s ease-out; /* Fade-in animation */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Title Styling */
.gkp-title {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2.2em;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

.gkp-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background-color: #FDC808; /* Primary color */
    border-radius: 2px;
}

/* Introductory Text */
.gkp-intro-text {
    text-align: center;
    margin-bottom: 30px;
    color: #555;
    font-size: 1.1em;
    line-height: 1.6;
}

/* Form Group Layout */
.gkp-form-group {
    display: flex;
    gap: 15px; /* Space between input and button */
    margin-bottom: 15px; /* Adjusted for multiple form groups */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    justify-content: center;
    align-items: center; /* Align items vertically in the center */
}

/* Last form group for submit button */
.gkp-form-group.gkp-form-submit {
    margin-bottom: 0; /* No bottom margin for the last group */
    justify-content: center; /* Center the button */
}

/* Ensure inputs align and have same width */
#gkp-keyword-input,
#gkp-location-select {
    flex-basis: 80%;   /* fixed basis to keep same width */
    box-sizing: border-box;
}

/* Input Field Styling */
#gkp-keyword-input,
#gkp-location-select {
    height: 44px;
    padding: 0 18px;
    border: 1px solid #c0c0c0;
    border-radius: 8px;
    font-size: 1.1em;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    appearance: none; /* for select */
    background-color: #fff;
    cursor: text;
}

#gkp-keyword-input::placeholder,
#gkp-location-select option {
    color: #a0a0a0;
}

#gkp-keyword-input:focus,
#gkp-location-select:focus {
    border-color: #FDC808;
    outline: none;
    box-shadow: 0 0 0 3px rgba(253, 200, 8, 0.25);
}

/* Add arrow to the select */
#gkp-location-select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px 16px;
    cursor: pointer;
}

/* Submit button container */
.gkp-form-submit {
    width: 100%;
    text-align: center;
}

/* Button styling */
.gkp-form-submit button.gkp-button {
    min-width: 220px;
    width: auto;
}

.gkp-button {
    background-color: #FDC808;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 14px 35px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(253, 200, 8, 0.25);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gkp-button:hover {
    background-color: #D4A200;
    box-shadow: 0 6px 15px rgba(253, 200, 8, 0.35);
    transform: translateY(-2px);
}

.gkp-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(253, 200, 8, 0.2);
}

.gkp-button .gkp-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Loading Indicator */
.gkp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    color: #D4A200; /* Darker shade of primary color for text */
    font-size: 1.1em;
    font-weight: 500;
    padding: 15px;
    background-color: #FFF8E1; /* Very light shade of primary color for background */
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.gkp-spinner {
    border: 4px solid rgba(253, 200, 8, 0.2); /* Primary color with transparency */
    border-top: 4px solid #FDC808; /* Primary color */
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Area */
.gkp-results {
    margin-top: 30px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
    border-top: 1px solid #eee;
    padding-top: 20px;
    transition: opacity 0.5s ease-out; /* Fade in results */
}

.gkp-results.hidden {
    opacity: 0;
}

.gkp-initial-message, .gkp-no-results {
    text-align: center;
    color: #666;
    padding: 20px;
    background-color: #f8f8f8;
    border-radius: 8px;
    border: 1px dashed #ddd;
    font-style: italic;
}

/* Section Titles for Results */
.gkp-section-title {
    font-size: 1.6em;
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}

/* Results Table Styling */
.gkp-results-table {
    width: 100%;
    border-collapse: separate; /* For rounded corners */
    border-spacing: 0;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners on table */
}

.gkp-results-table th, .gkp-results-table td {
    padding: 15px 20px;
    text-align: left;
    font-size: 0.95em;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s ease;
}

.gkp-results-table th {
    background-color: #e9ecef; /* Light header background */
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gkp-results-table tbody tr:nth-child(odd) {
    background-color: #fcfdff; /* Lighter stripe */
}

.gkp-results-table tbody tr:hover {
    background-color: #eaf6ff; /* Highlight on hover */
}

/* Competition Level Styling */
.gkp-comp-low td:last-child {
    color: #28a745; /* Green */
    font-weight: 600;
}
.gkp-comp-medium td:last-child {
    color: #ffc107; /* Orange */
    font-weight: 600;
}
.gkp-comp-high td:last-child {
    color: #dc3545; /* Red */
    font-weight: 600;
}

/* Error Messages */
.gkp-error-message {
    background-color: #ffebe9; /* Light red background */
    border: 1px solid #dc3545; /* Red border */
    color: #dc3545 !important; /* Red text */
    padding: 15px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

/* --- Mobile Responsiveness Enhancements --- */

/* For screens up to 768px (tablets and smaller desktops) */
@media (max-width: 768px) {
    #gkp-keyword-form {
        flex-direction: column;
        gap: 20px;
    }
    #gkp-keyword-input,
    #gkp-location-select {
        max-width: 100%;
        min-width: 100%;
        flex: none;
        height: 44px;
    }

    .gkp-form-submit button.gkp-button {
        width: 100%;
        min-width: unset;
    }
}

/* For very small screens (phones) */
@media (max-width: 480px) {
    .google-keyword-planner-container {
        padding: 15px;
        margin: 15px auto;
    }
    .gkp-title {
        font-size: 1.5em;
        padding-bottom: 10px;
    }
    .gkp-title::after {
        width: 40px;
        height: 3px;
    }
    .gkp-intro-text {
        font-size: 0.9em;
    }
    .gkp-button {
        font-size: 1em;
        padding: 10px 15px;
    }
    /* Further adjust table cell padding for very small screens */
    .gkp-results-table td {
        padding: 10px 12px;
        padding-left: 45%; /* Adjust for smaller screens */
        font-size: 0.85em;
    }
    .gkp-results-table td::before {
        width: 40%;
        padding-left: 10px;
        font-size: 0.8em;
    }
}


.gkp-form-top-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%; /* Ensure container uses full width */
    max-width: 700px; /* Optional max width to keep them centered nicely */
    margin: 0 auto; /* Center horizontally */
}

.gkp-form-top-row .gkp-form-group {
    flex: 1 1 50%; /* Take roughly half each */
    min-width: 250px; /* Minimum width to prevent shrinking too small */
    box-sizing: border-box;
}

.gkp-form-top-row input[type="text"],
.gkp-form-top-row select {
    width: 80% !important; /* Full width within their flex container */
    height: 44px;
}


/* Flex container for Search + Export CSV buttons */
.gkp-button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Override form group margin inside button group */
.gkp-button-group .gkp-form-group {
    margin: 0;
}

/* Export button styling */
.gkp-export-btn {
    background-color: #4caf50; /* green */
    border: none;
    color: #fff;
    padding: 14px 35px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.25);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.gkp-export-btn:hover {
    background-color: #43a047;
    box-shadow: 0 6px 15px rgba(67, 160, 71, 0.35);
    transform: translateY(-2px);
}

.gkp-export-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(67, 160, 71, 0.2);
}

/* Responsive: stack buttons on small screens */
@media (max-width: 480px) {
    .gkp-button-group {
        flex-direction: column;
    }
    .gkp-button-group .gkp-form-group {
        width: 100%;
    }
    .gkp-button, .gkp-export-btn {
        width: 100%;
        justify-content: center;
    }
}


/* Responsive table: stack rows on small screens */
@media (max-width: 480px) {
  .gkp-results-table,
  .gkp-results-table thead,
  .gkp-results-table tbody,
  .gkp-results-table th,
  .gkp-results-table td,
  .gkp-results-table tr {
    display: block;
  }

  /* Hide table headers on mobile */
  .gkp-results-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  /* Each row as a card */
  .gkp-results-table tr {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  }

  /* Style each cell */
.gkp-results-table td {
  display: flex;
  align-items: center;
  padding-left: 15px; /* Small padding since labels will be inline */
  border: none;
  border-bottom: 1px solid #eee;
  font-size: 0.9em;
  gap: 10px;
}
}

.gkp-form-top-row select{
	width:80% !important;
}